-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
8
-
generic
-
generic
FULL PRODUCT VERSION :
java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
macOS Sierra 10.12.4
A DESCRIPTION OF THE PROBLEM :
There appears to be a bug in javac that's somehow related to an import of an inner-class of an inner-class. If the inner-inner-class is moved out so that it is an inner-class, compilation succeeds.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the source code for the two classes that is provided below:
$ javac com/example/JavacProblem.java com/example/annotation/Configuration.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The code compiles successfully
ACTUAL -
JavacProblem.java fails to compile on line 15:
$ javac com/example/JavacProblem.java com/example/annotation/Configuration.java
com/example/JavacProblem.java:15: error: cannot find symbol
@Configuration
^
symbol: class Configuration
location: class JavacProblem
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
com/example/JavacProblem.java:
package com.example;
import com.example.JavacProblem.ConfigurationTwo.AnInnerClass;
import com.example.annotation.Configuration;
public class JavacProblem {
AnInnerClass customBean;
@Configuration
static class ConfigurationOne {
}
@Configuration
static class ConfigurationTwo {
static final class AnInnerClass {
}
}
}
com/example/annotation/Configuration.java
package com.example.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Configuration {
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Move AnInnerClass so that it is an inner class of JavacProblem rather than ConfigurationTwo
java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
macOS Sierra 10.12.4
A DESCRIPTION OF THE PROBLEM :
There appears to be a bug in javac that's somehow related to an import of an inner-class of an inner-class. If the inner-inner-class is moved out so that it is an inner-class, compilation succeeds.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the source code for the two classes that is provided below:
$ javac com/example/JavacProblem.java com/example/annotation/Configuration.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The code compiles successfully
ACTUAL -
JavacProblem.java fails to compile on line 15:
$ javac com/example/JavacProblem.java com/example/annotation/Configuration.java
com/example/JavacProblem.java:15: error: cannot find symbol
@Configuration
^
symbol: class Configuration
location: class JavacProblem
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
com/example/JavacProblem.java:
package com.example;
import com.example.JavacProblem.ConfigurationTwo.AnInnerClass;
import com.example.annotation.Configuration;
public class JavacProblem {
AnInnerClass customBean;
@Configuration
static class ConfigurationOne {
}
@Configuration
static class ConfigurationTwo {
static final class AnInnerClass {
}
}
}
com/example/annotation/Configuration.java
package com.example.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Configuration {
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Move AnInnerClass so that it is an inner class of JavacProblem rather than ConfigurationTwo