Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support record types #1405

Open
raiju opened this issue Jun 11, 2020 · 2 comments
Open

Support record types #1405

raiju opened this issue Jun 11, 2020 · 2 comments

Comments

@raiju
Copy link
Contributor

raiju commented Jun 11, 2020

What happened?

When using record types, I hit the following issues:

  • Misfiring StrictUnusedVariable:
Foo.java:43: error: [StrictUnusedVariable] The parameter 'a' is never read.
    record Foo(int a, int b) {}
  • Checkstyle; record in class: Checkstyle: Method name 'Foo' must match pattern '^[a-z][a-zA-Z0-9_]+$'.

  • checkUnusedDependenciesMain fails with This feature requires ASM8_EXPERIMENTAL

I ended up adding the following overrides for now:

build.gradle

tasks.withType(JavaCompile).configureEach {
    options.compilerArgs += ["--enable-preview"]
    options.errorprone.disable 'StrictUnusedVariable'
}
tasks.javadoc.options {
    addBooleanOption('-enable-preview', true)
    addStringOption('-release', '14')
}
tasks.withType(Test).configureEach {
    jvmArgs(['--enable-preview'])
}
tasks.checkUnusedDependenciesMain.enabled = false

custom-suppressions.xml

...
    <suppress files="[/\\]src[/\\]" checks="MethodName" />
...

What did you want to happen?

Records are supported without issues.

@ferozco
Copy link
Contributor

ferozco commented Jun 12, 2020

@raiju can you confirm that this issue has been resolved?

@raiju
Copy link
Contributor Author

raiju commented Jun 12, 2020

--- a/build.gradle
+++ b/build.gradle
@@ -10,7 +10,7 @@ buildscript {
         classpath 'com.palantir.jakarta-renames:gradle-jakarta-renames:0.3.11'
         classpath 'com.palantir.javaformat:gradle-palantir-java-format:1.0.0'
         classpath 'com.palantir.apollo:gradle-apollo:0.69.0'
-        classpath 'com.palantir.baseline:gradle-baseline-java:3.23.0'
+        classpath 'com.palantir.baseline:gradle-baseline-java:3.26.0'
         classpath 'com.palantir.blacklist:gradle-blacklist-plugin:0.13.0'
         classpath 'com.palantir.conjure.backcompat:gradle-conjure-backcompat:3.4.1'
         classpath 'com.palantir.deployability:gradle-sls-docker:1.13.0'
diff --git a/scenarios/build.gradle b/scenarios/build.gradle
index 16cf81b..15b6cb0 100644
--- a/scenarios/build.gradle
+++ b/scenarios/build.gradle
@@ -19,7 +19,6 @@ sourceCompatibility = 14
 // Records!
 tasks.withType(JavaCompile).configureEach {
     options.compilerArgs += ["--enable-preview"]
-    options.errorprone.disable 'StrictUnusedVariable'
 }

I still get StrictUnusedVariable errors when run with this diff ^

The checkUnusedDependenciesMain task also still fails (with the same error)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants