-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
8, 11, 17, 21, 22
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
When using an annotation processor library which generates new classes which are referenced by the files in the initial round of compilation, and one of the original files also contain an error, javac will report all errors including those related to missing classes which would have been generated in the next round of processing. When the number of missing classes is quite important, this makes diagnosing the actual issue very hard to find amongst tens of hundreds of error messages.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1/ Get immutables library from Maven Central
https://repo1.maven.org/maven2/org/immutables/value/2.10.1/value-2.10.1.jar
2/ try to compile both source files (Bad.java and ValueObject.java)
3/ Check javac output
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Javac should only report the problem in Bad.java
```
example/Bad.java:10: error: method bad() is already defined in class Bad
public void bad() {
^
1 error
```
ACTUAL -
Javac also reports about missing classes
```
example/ValueObject.java:9: error: cannot find symbol
public interface ValueObject extends WithValueObject {
^
symbol: class WithValueObject
example/ValueObject.java:15: error: package ImmutableValueObject does not exist
class Builder extends ImmutableValueObject.Builder {}
^
example/Bad.java:10: error: method bad() is already defined in class Bad
public void bad() {
^
3 errors
```
---------- BEGIN SOURCE ----------
// example/Bad.java
package example;
/**
* A class with a duplicate method
*/
class Bad {
public void bad() {
}
public void bad() {
}
}
// example/ValueObject.java
package example;
import java.util.List;
import java.util.Optional;
import org.immutables.value.Value;
// Define abstract value type using interface, abstract class or annotation
@Value.Immutable
public interface ValueObject extends WithValueObject {
// WithValueObject is not yet generated, We extend With* to inherit `with*` method signatures
String name();
List<Integer> counts();
Optional<String> description();
class Builder extends ImmutableValueObject.Builder {}
// ImmutableValueObject.Builder will be generated and
// our builder will inherit and reexport methods as its own.
// Static nested Builder will inherit all the public method
// signatures of ImmutableValueObject.Builder
}
---------- END SOURCE ----------
FREQUENCY : always
When using an annotation processor library which generates new classes which are referenced by the files in the initial round of compilation, and one of the original files also contain an error, javac will report all errors including those related to missing classes which would have been generated in the next round of processing. When the number of missing classes is quite important, this makes diagnosing the actual issue very hard to find amongst tens of hundreds of error messages.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1/ Get immutables library from Maven Central
https://repo1.maven.org/maven2/org/immutables/value/2.10.1/value-2.10.1.jar
2/ try to compile both source files (Bad.java and ValueObject.java)
3/ Check javac output
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Javac should only report the problem in Bad.java
```
example/Bad.java:10: error: method bad() is already defined in class Bad
public void bad() {
^
1 error
```
ACTUAL -
Javac also reports about missing classes
```
example/ValueObject.java:9: error: cannot find symbol
public interface ValueObject extends WithValueObject {
^
symbol: class WithValueObject
example/ValueObject.java:15: error: package ImmutableValueObject does not exist
class Builder extends ImmutableValueObject.Builder {}
^
example/Bad.java:10: error: method bad() is already defined in class Bad
public void bad() {
^
3 errors
```
---------- BEGIN SOURCE ----------
// example/Bad.java
package example;
/**
* A class with a duplicate method
*/
class Bad {
public void bad() {
}
public void bad() {
}
}
// example/ValueObject.java
package example;
import java.util.List;
import java.util.Optional;
import org.immutables.value.Value;
// Define abstract value type using interface, abstract class or annotation
@Value.Immutable
public interface ValueObject extends WithValueObject {
// WithValueObject is not yet generated, We extend With* to inherit `with*` method signatures
String name();
List<Integer> counts();
Optional<String> description();
class Builder extends ImmutableValueObject.Builder {}
// ImmutableValueObject.Builder will be generated and
// our builder will inherit and reexport methods as its own.
// Static nested Builder will inherit all the public method
// signatures of ImmutableValueObject.Builder
}
---------- END SOURCE ----------
FREQUENCY : always
- relates to
-
JDK-8323057 Recoverable errors may be reported before unrecoverable errors when annotation processing is skipped
- Resolved