-
Bug
-
Resolution: Fixed
-
P4
-
1.2.1, 1.3.0, 1.4.0
-
hopper
-
generic, x86
-
generic, windows_98, windows_nt, windows_2000
-
Verified
Name: tb29552 Date: 08/25/2000
/*
stack over flow on loading class hemant$1$Readstring
*/
interface ReadIt
{
String readString();
}
public class Hemant {
ReadIt Write(final String s)
{
class ReadString implements ReadIt {
private String label;
private ReadString ()
{
label = s;
}
public String readString()
{
return label;
}
}
return new ReadString ();
}
public static void main(String args[])
{
Hemant h = new Hemant ();
ReadIt r = h.Write("hemant");
}
}
//while i am wroking above problem i got an error while trying to pass an
//varible to a innerclass Readstring if i make its constructer private
% javac -J-showversion Hemant.java
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-b27)
Java HotSpot(TM) Client VM (build 1.3.0-b27, mixed mode)
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: argument length mismatch: constructor ReadString()
at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:925)
at com.sun.tools.javac.v8.tree.Tree$Apply.visit(Tree.java:785)
at com.sun.tools.javac.v8.comp.Gen.genExpr(Gen.java:418)
at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:873)
at com.sun.tools.javac.v8.tree.Tree$Exec.visit(Tree.java:699)
at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:375)
at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java:392)
at com.sun.tools.javac.v8.comp.Gen.genStats(Gen.java:401)
at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:507)
at com.sun.tools.javac.v8.tree.Tree$Block.visit(Tree.java:492)
at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:375)
at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java:392)
at com.sun.tools.javac.v8.comp.Gen.genMethod(Gen.java:477)
at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:452)
at com.sun.tools.javac.v8.tree.Tree$MethodDef.visit(Tree.java:441)
at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:375)
at com.sun.tools.javac.v8.comp.Gen.genClass(Gen.java:1366)
at com.sun.tools.javac.v8.JavaCompiler.genCode(JavaCompiler.java:302)
at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:407)
at com.sun.tools.javac.v8.Main.compile(Main.java:247)
at com.sun.tools.javac.Main.main(Main.java:16)
(Review ID: 108930)
======================================================================
Name: tb29552 Date: 12/06/2000
/*
java version "1.2.1"
Classic VM (build JDK-1.2.1-A, native threads)
Attempt to compile this code will crash both the oldjavac and the gjc
compilers:
The workaround is to make the inner constructor protected or public.
*/
public class CompilerBug {
public void get() {
final int[] ia = new int[5];
class Inner {
private Inner () {
} // An explicit constructor is required
private void method() {
int[] ia2 = new int[ia.length]; /* ia.length must not be
* literal and it must be
* declared in get()'s
* namespace
*/
}
}; // End class Inner
new Inner (); // the constructor must be explicitly called
}
}
(Review ID: 113324)
======================================================================
Name: rmT116609 Date: 11/14/2001
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)
The problem is reproducible with JDK1.3.1, 1.3.1_01, 1.4.0-beta3
Got following exception from the compiler when compiling the testapp below:
java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)
$% javac MethodClass.java
An exception has occurred in the compiler (1.4.0-beta3). Please file a bug at the Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.InternalError: argument length mismatch: constructor Inner()
at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:1159)
at com.sun.tools.javac.v8.tree.Tree$Apply.visit(Tree.java:869)
at com.sun.tools.javac.v8.comp.Gen.genExpr(Gen.java:596)
at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:1101)
at com.sun.tools.javac.v8.tree.Tree$Exec.visit(Tree.java:765)
at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:436)
at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java:473)
at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java:457)
at com.sun.tools.javac.v8.comp.Gen.genStats(Gen.java:508)
at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:699)
at com.sun.tools.javac.v8.tree.Tree$Block.visit(Tree.java:539)
at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:436)
at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java:473)
at com.sun.tools.javac.v8.comp.Gen.genMethod(Gen.java:653)
at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:626)
at com.sun.tools.javac.v8.tree.Tree$MethodDef.visit(Tree.java:474)
at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:436)
at com.sun.tools.javac.v8.comp.Gen.genClass(Gen.java:1625)
at com.sun.tools.javac.v8.JavaCompiler.genCode(JavaCompiler.java:324)
at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:425)
at com.sun.tools.javac.v8.Main.compile(Main.java:526)
at com.sun.tools.javac.Main.compile(Main.java:32)
at com.sun.tools.javac.Main.main(Main.java:23)
/** Testapp for inner classes. */
public class MethodClass {
private int m = (int)(Math.random() * 100);
public static void main(String [] args) {
MethodClass mc = new MethodClass();
for (int i = 0; i < 5; i++) {
mc.go((i + 1),((int)(Math.random() * 5)));
}
}
/**
* Method with an inner class
*/
public void go(int x, final int y) {
int a = x + y;
final int b = x - y;
class Inner {
private Inner() { //here the InternalError occures ;
}
public void method() {
System.out.println("MethodClass.m=" + m);
System.out.println("MetodClass.go().y=" + y);
System.out.println("MethodClass.go().b=" + b);
}
}
Inner that = new Inner();
that.method();
}
}
(Review ID: 135660)
======================================================================