Name: dbT83986 Date: 02/17/99
NB There is no error when jdk-1.2beta4 is used.
1
bash$ javac Samma.java
2
import java.io.*;
// This code was written to show scoping in java for my students.
// In swedish samma means "the same" which is what it is not.
/* samma */
class Samma {
public static void main (String[] args) {
samma samma;
samma = new samma();
System.out.println("samma " + samma);
}
}
class samma {
samma samma;
{ //
samma samma; // The bug appeared when I added this
} //
public samma() {
samma samma = this.samma;
}
public samma(samma samma) {
this.samma = samma;
}
}
3
java.lang.NullPointerException
at sun.tools.tree.DeclarationStatement.inline(DeclarationStatement.java)
at sun.tools.tree.CompoundStatement.inline(CompoundStatement.java)
at sun.tools.tree.InlineMethodExpression.inline(InlineMethodExpression.java)
at sun.tools.tree.CommaExpression.inline(CommaExpression.java)
at sun.tools.tree.MethodExpression.inline(MethodExpression.java)
at sun.tools.tree.ExpressionStatement.inline(ExpressionStatement.java)
at sun.tools.tree.CompoundStatement.inline(CompoundStatement.java)
at sun.tools.javac.SourceField.inline(SourceField.java)
at sun.tools.javac.SourceField.code(SourceField.java)
at sun.tools.javac.SourceClass.compileClass(SourceClass.java)
at sun.tools.javac.SourceClass.compile(SourceClass.java)
at sun.tools.javac.Main.compile(Main.java)
at sun.tools.javac.Main.main(Main.java)
error: An exception has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
1 error
5
OS Version is 5.6
Kernel Version is SunOS Release 5.6 Version Generic_105181-07 [UNIX(R) System V Release 4.0]
(Review ID: 53687)
======================================================================
Name: skT88420 Date: 06/18/99
// compile this code using "javac Program2.java"
class Point2D {
public Point2D() {
x=0;
y=0;
}
private double x,y; {
double x;
double y;
double s;
double length;
}
public Point2D(double xIn, double yIn) {
x = xIn;
y = yIn;
}
public void Scale(double scaleFactor) {
x = scaleFactor * x;
y = scaleFactor * y;
}
public double length() {
return (Math.sqrt((x * x) + (y * y)));
}
}
class Program2{
private double x,y; {
double x;
double y;
double s;
}
public void main (String[] args){
System.out.println("Enter x: ");
x = Keyboard.readDouble();
System.out.print("Enter y: ");
y = Keyboard.readDouble();
System.out.print("Enter s: ");
s = Keyboard.readDouble();
System.out.print("(");
System.out.print(x);
System.out.print(",");
System.out.print(y);
System.out.print(")");
}
public void Print () {
System.out.print("Length is" + length);
0 = yes;
1 = no;
System.out.print("Do Another? (0 = Yes, 1 = No): ");
}
}
(Review ID: 39896)
======================================================================
Name: skT88420 Date: 07/08/99
When compiling a source file using javac -O I get the following:
------------------------------------------------------------
java.lang.NullPointerException:
at sun.tools.tree.FieldExpression.costInline(FieldExpression.java:851)
at sun.tools.tree.NaryExpression.costInline(NaryExpression.java:63)
at sun.tools.tree.ReturnStatement.costInline(ReturnStatement.java:119)
at sun.tools.tree.MethodExpression.inlineValue(MethodExpression.java:518)
at sun.tools.tree.VarDeclarationStatement.inline(VarDeclarationStatement.java:139)
at sun.tools.tree.DeclarationStatement.inline(DeclarationStatement.java:71)
at sun.tools.tree.CompoundStatement.inline(CompoundStatement.java:87)
at sun.tools.javac.SourceField.inline(SourceField.java:518)
at sun.tools.javac.SourceField.code(SourceField.java:600)
at sun.tools.javac.SourceClass.compileClass(SourceClass.java:1463)
at sun.tools.javac.SourceClass.compile(SourceClass.java:1414)
at sun.tools.javac.Main.compile(Main.java:331)
at sun.tools.javac.Main.main(Main.java:473)
error: An exception has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
(Review ID: 85375)
======================================================================