Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4294065

class marked "private" in interface causes crash in Resolve.isAccessible()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.3.1
    • 1.3.0
    • tools
    • ladybird
    • generic
    • generic
    • Verified

        public interface InputOutput {
            
            Object nullWriter = null;

            // It appears that makeAccessible() assumes that the class has public
            // access. The compiler compiles the following two lines without complaint.
            
        // class SomeClass implements InputOutput {
        // public class SomeClass implements InputOutput {

            // With either of these lines, the compiler reports an illegal combination
            // of modifiers and crashes.
        // protected class SomeClass implements InputOutput {
            private class SomeClass implements InputOutput {
               public Object getOut() {
               return nullWriter;
               }
            }
        }

        $ javac InputOutput.java
        InputOutput.java:14: illegal combination of modifiers: public and private
            private class SomeClass implements InputOutput {
                    ^
        An exception has occurred in the compiler (1.3.0). Please file a bug at the Java
        Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi). Include your
        program and the following diagnostic in your report. Thank you.
        java.lang.InternalError
             at com.sun.tools.javac.v8.comp.Resolve.isAccessible(Resolve.java:100)
             at com.sun.tools.javac.v8.comp.Resolve.isAccessible(Resolve.java:120)
             at com.sun.tools.javac.v8.comp.Resolve.isAccessible(Resolve.java:144)
             at com.sun.tools.javac.v8.comp.Resolve.findField(Resolve.java:241)
             at com.sun.tools.javac.v8.comp.Resolve.findField(Resolve.java:251)
             at com.sun.tools.javac.v8.comp.Resolve.findVar(Resolve.java:272)
             at com.sun.tools.javac.v8.comp.Resolve.findIdent(Resolve.java:526)
             at com.sun.tools.javac.v8.comp.Resolve.resolveIdent(Resolve.java:663)
             at com.sun.tools.javac.v8.comp.Attr._case(Attr.java:938)
             at com.sun.tools.javac.v8.tree.Tree$Ident.visit(Tree.java:994)
             at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:239)
             at com.sun.tools.javac.v8.comp.Attr.attribExpr(Attr.java:259)
             at com.sun.tools.javac.v8.comp.Attr._case(Attr.java:638)
             at com.sun.tools.javac.v8.tree.Tree$Return.visit(Tree.java:763)
             at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:239)
             at com.sun.tools.javac.v8.comp.Attr.attribStat(Attr.java:281)
             at com.sun.tools.javac.v8.comp.Attr.attribStats(Attr.java:297)
             at com.sun.tools.javac.v8.comp.Attr._case(Attr.java:408)
             at com.sun.tools.javac.v8.tree.Tree$Block.visit(Tree.java:504)
             at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:239)
             at com.sun.tools.javac.v8.comp.Attr.attribStat(Attr.java:281)
             at com.sun.tools.javac.v8.comp.Attr._case(Attr.java:375)
             at com.sun.tools.javac.v8.tree.Tree$MethodDef.visit(Tree.java:453)
             at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:239)
             at com.sun.tools.javac.v8.comp.Attr.attribStat(Attr.java:281)
             at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1322)
             at com.sun.tools.javac.v8.comp.Attr._case(Attr.java:342)
             at com.sun.tools.javac.v8.tree.Tree$ClassDef.visit(Tree.java:415)
             at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:239)
             at com.sun.tools.javac.v8.comp.Attr.attribStat(Attr.java:281)
             at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1322)
             at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:384)
             at com.sun.tools.javac.v8.Main.compile(Main.java:258)
             at com.sun.tools.javac.Main.main(Main.java:31)

        iris.garcia@eng 1999-11-23

              gafter Neal Gafter (Inactive)
              iris Iris Clark
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: