The following code causes an internal Error in the compiler.
class bug {
void show_bug() {
try {
int i = 1;
} finally {
doit(null);
}
}
void doit (String msg) {}
}
gives
pan:~/public_html/classes[1106] oakc bug.oak
oak.tools.oak.InternalError selectType: convert
at oak.lang.Exception.<init>(Exception.oak)
at oak.tools.oak.InternalError.<init>(InternalError.oak)
at oak.tools.tree.UnaryExpression.selectType(UnaryExpression.oak)
at oak.tools.tree.UnaryExpression.checkValue(UnaryExpression.oak)
at oak.tools.tree.MethodExpression.checkValue(MethodExpression.oak)
at oak.tools.tree.MethodExpression.check(MethodExpression.oak)
at oak.tools.tree.ExpressionStatement.check(ExpressionStatement.oak)
at oak.tools.tree.CompoundStatement.check(CompoundStatement.oak)
at oak.tools.tree.FinallyStatement.check(FinallyStatement.oak)
at oak.tools.tree.CompoundStatement.check(CompoundStatement.oak)
oakc: an exception has occurred, please contact x47242.
For whatever it's worth, a doit(null) in the try{ } causes no problem. It has to be
in the finally { } clause to get the error.
The description field as copied from bug report 1186173 follows:
When I compile the following code:
import oak.io.*;
class foo {
static void broken()
{
InputStream f = null;
try {
f = new FileInputStream("/tmp/junk");
} finally {
if (f != null)
f.close();
}
}
}
I get the following:
pan:/tmp[1028] oakc foo.oak
oak.tools.oak.InternalError selectType: convert
at oak.lang.Exception.<init>(Exception.oak)
at oak.tools.oak.InternalError.<init>(InternalError.oak)
at oak.tools.tree.UnaryExpression.selectType(UnaryExpression.oak)
at oak.tools.tree.UnaryExpression.checkValue(UnaryExpression.oak)
at oak.tools.tree.BinaryExpression.checkValue(BinaryExpression.oak)
at oak.tools.tree.Expression.checkCondition(Expression.oak)
at oak.tools.tree.Expression.checkCondition(Expression.oak)
at oak.tools.tree.IfStatement.check(IfStatement.oak)
at oak.tools.tree.CompoundStatement.check(CompoundStatement.oak)
at oak.tools.tree.FinallyStatement.check(FinallyStatement.oak)
oakc: an exception has occurred, please contact x47242.
class bug {
void show_bug() {
try {
int i = 1;
} finally {
doit(null);
}
}
void doit (String msg) {}
}
gives
pan:~/public_html/classes[1106] oakc bug.oak
oak.tools.oak.InternalError selectType: convert
at oak.lang.Exception.<init>(Exception.oak)
at oak.tools.oak.InternalError.<init>(InternalError.oak)
at oak.tools.tree.UnaryExpression.selectType(UnaryExpression.oak)
at oak.tools.tree.UnaryExpression.checkValue(UnaryExpression.oak)
at oak.tools.tree.MethodExpression.checkValue(MethodExpression.oak)
at oak.tools.tree.MethodExpression.check(MethodExpression.oak)
at oak.tools.tree.ExpressionStatement.check(ExpressionStatement.oak)
at oak.tools.tree.CompoundStatement.check(CompoundStatement.oak)
at oak.tools.tree.FinallyStatement.check(FinallyStatement.oak)
at oak.tools.tree.CompoundStatement.check(CompoundStatement.oak)
oakc: an exception has occurred, please contact x47242.
For whatever it's worth, a doit(null) in the try{ } causes no problem. It has to be
in the finally { } clause to get the error.
The description field as copied from bug report 1186173 follows:
When I compile the following code:
import oak.io.*;
class foo {
static void broken()
{
InputStream f = null;
try {
f = new FileInputStream("/tmp/junk");
} finally {
if (f != null)
f.close();
}
}
}
I get the following:
pan:/tmp[1028] oakc foo.oak
oak.tools.oak.InternalError selectType: convert
at oak.lang.Exception.<init>(Exception.oak)
at oak.tools.oak.InternalError.<init>(InternalError.oak)
at oak.tools.tree.UnaryExpression.selectType(UnaryExpression.oak)
at oak.tools.tree.UnaryExpression.checkValue(UnaryExpression.oak)
at oak.tools.tree.BinaryExpression.checkValue(BinaryExpression.oak)
at oak.tools.tree.Expression.checkCondition(Expression.oak)
at oak.tools.tree.Expression.checkCondition(Expression.oak)
at oak.tools.tree.IfStatement.check(IfStatement.oak)
at oak.tools.tree.CompoundStatement.check(CompoundStatement.oak)
at oak.tools.tree.FinallyStatement.check(FinallyStatement.oak)
oakc: an exception has occurred, please contact x47242.
- duplicates
-
JDK-1186173 try/finally gives Internal error in the compiler
-
- Closed
-