JDK-6861837 : JCK compilation failures
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,windows_xp
  • CPU: generic,x86
  • Submitted: 2009-07-17
  • Updated: 2012-03-22
  • Resolved: 2012-01-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b70Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
The following test fails at precompilation step:

api/java_util/concurrent/ExecutorCompletionService/index.html#ExecutorCompletionService

jtr file is attached.
The following minitest (extracted from ExecutorCompletionServiceTest.java) fails to compile with NPE since b64:
--------------------------------------------------------------------
import java.util.concurrent.*;

public class ExecutorCompletionServiceTest {
    ExecutorService e = new ThreadPoolExecutor(
            1, 1, 30L, TimeUnit.SECONDS,
            new ArrayBlockingQueue<Runnable>(1)) {
        protected <T> RunnableFuture<T> newTaskFor(Runnable t, T r) {
            return null;
        }
    };
}
--------------------------------------------------------------------
The work around from CR 6860795(-XDoldDiags) doesn't work.
Please find the stack trace in attached minitest.log.
The following test fails at precompilation stage as well:

api/javax_lang/model/element/UnknownElementException/index.html#UElementException

See 6861840 for jtr file is attached.

In short, the following java class fails to compile with the stack trace similar to reported:

-----------------
package javasoft.sqe.tests.api.javax.lang.model.element.UnknownElementException;

import java.lang.annotation.Annotation;
import java.util.List;
import java.util.Set;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ElementVisitor;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.Name;
import javax.lang.model.element.UnknownElementException;
import javax.lang.model.type.TypeMirror;


public class UElementExceptionTests {

    public void ctor0001() {
        Element[] elements = {
            new Element() {

                public List<? extends AnnotationMirror> getAnnotationMirrors() {
                    return null;
                }

                public <A extends Annotation> A getAnnotation(
                        Class<A> annotationType) {
                    return null;
                }

                public Set<Modifier> getModifiers() {
                    return null;
                }

                public Name getSimpleName() {
                    return null;
                }

                public Element getEnclosingElement() {
                    return null;
                }

                public List<? extends Element> getEnclosedElements() {
                    return null;
                }

                public <R, P> R accept(ElementVisitor<R, P> v, P p) {
                    return null;
                }
            }
        };

      
    }
}
--------------

Comments
SUGGESTED FIX A webrev of this fix is available at the following URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/6d0add6ad778
30-07-2009

EVALUATION This is not the same failure described in 6860795 - more specifically this is not a failure caused by the fact that we are using a rich formatter. This failure seems to be related with annotation processing - probably sneaked in during the 308 work. Here's the stack trace: java.lang.NullPointerException at com.sun.tools.javac.comp.MemberEnter$TypeAnnotate$1.enterAnnotation(MemberEnter.java:1050) at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:109) at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:2142) at com.sun.tools.javac.code.Symbol.complete(Symbol.java:416) at com.sun.tools.javac.code.Symbol$PackageSymbol.flags(Symbol.java:654) [...] The failure seems to be cause by two factors: (i) the generic method being declared inside the anonymous inner class (ii) the fact that Test has a non-empty constructor. If any of the above two conditions is not matched the failure is not reproducible. The problem seems to be caused by the fact that type parameter annotation of inner classes type variables are annotated before such type-variables are entered and attributed. The fact that the field type is still set to null when determining the type parameter (type) annotation causes the NPE.
20-07-2009