-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
7
FULL PRODUCT VERSION :
java version " 1.7.0_07 "
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7: Microsoft Windows [Version 6.1.7601]
I haven't tested other OS.
EXTRA RELEVANT SYSTEM CONFIGURATION :
Tested it directly via command line or with ant 1.8.2 with same result.
A DESCRIPTION OF THE PROBLEM :
The source code submitted below does not compile. I get an compilation error. The JDK6 and the eclipse compiler do not complain.
I have talked to several people about this problem and we are pretty certain, that this is a bug in the compiler. Espcially since changing the Problem class to
public abstract class ProblemClass<A extends DefaultWrapper<? extends Type1>> {}
makes the compiler happy (removed the bound I1, see submitted code) although the interface I1 has nothing to do with the method getWrappedObject().
Unfortunately I need this bound in our code.
REGRESSION. Last worked in version 6u31
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the submitted code (I have all files in the same package).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The code compiles.
ACTUAL -
The jdk compiler compiles with 1 error.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
src\com\mytest\ProblemClass.java:4: error: types DefaultWrapper<? extends Type1> and AbstractWrapper<? extends Type1> are incompatible; both define getWrappedObject(), but with unrelated return types
public abstract class ProblemClass<A extends DefaultWrapper<? extends Type1> & I1> {
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public interface I1 {}
public class BaseType {}
public class Type1 extends BaseType {}
public abstract class AbstractWrapper<T extends BaseType> {
public T getWrappedObject () {
return null;
}
}
public abstract class DefaultWrapper<T extends Type1> extends AbstractWrapper<T> {}
public abstract class ProblemClass<A extends DefaultWrapper<? extends Type1> & I1> {}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Override the method in DefaultWrapper and call the super implementation:
public abstract class DefaultWrapper<T extends Type1> extends AbstractWrapper<T> {
@Override
public T getWrappedObject() {
return super.getWrappedObject();
}
}
java version " 1.7.0_07 "
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7: Microsoft Windows [Version 6.1.7601]
I haven't tested other OS.
EXTRA RELEVANT SYSTEM CONFIGURATION :
Tested it directly via command line or with ant 1.8.2 with same result.
A DESCRIPTION OF THE PROBLEM :
The source code submitted below does not compile. I get an compilation error. The JDK6 and the eclipse compiler do not complain.
I have talked to several people about this problem and we are pretty certain, that this is a bug in the compiler. Espcially since changing the Problem class to
public abstract class ProblemClass<A extends DefaultWrapper<? extends Type1>> {}
makes the compiler happy (removed the bound I1, see submitted code) although the interface I1 has nothing to do with the method getWrappedObject().
Unfortunately I need this bound in our code.
REGRESSION. Last worked in version 6u31
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the submitted code (I have all files in the same package).
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The code compiles.
ACTUAL -
The jdk compiler compiles with 1 error.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
src\com\mytest\ProblemClass.java:4: error: types DefaultWrapper<? extends Type1> and AbstractWrapper<? extends Type1> are incompatible; both define getWrappedObject(), but with unrelated return types
public abstract class ProblemClass<A extends DefaultWrapper<? extends Type1> & I1> {
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public interface I1 {}
public class BaseType {}
public class Type1 extends BaseType {}
public abstract class AbstractWrapper<T extends BaseType> {
public T getWrappedObject () {
return null;
}
}
public abstract class DefaultWrapper<T extends Type1> extends AbstractWrapper<T> {}
public abstract class ProblemClass<A extends DefaultWrapper<? extends Type1> & I1> {}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Override the method in DefaultWrapper and call the super implementation:
public abstract class DefaultWrapper<T extends Type1> extends AbstractWrapper<T> {
@Override
public T getWrappedObject() {
return super.getWrappedObject();
}
}
- duplicates
-
JDK-8004094 Javac compiler error - synthetic method accessor generated with duplicate name
-
- Closed
-