Ooops, I posted with a wrong title, sorry.
From: jastadd-bounces_at_cs.lth.se [mailto:jastadd-bounces_at_cs.lth.se] On Behalf
Of Na, Hyunik
Sent: Thursday, November 24, 2011 7:17 PM
To: jastadd_at_cs.lth.se
Subject: Re: [Jastadd] fullCopy() och parent
Hi there,
I’m a CS graduate student studying programming languages,
and I’m thinking about using JastAddJ to implement an extended type system
for Java language.
( JastAddJ looks quite nice for my purpose. )
To see how well current JastAddJ compiler works, I did the following quick
test.
(1)
I downloaded OpenJDK 6 source code from
http://download.java.net/openjdk/jdk6/, and built it on my Linux machine.
( It was built in the directory
/home/hina/myWork/research/openjdk-1.6.0.0.hina, which is henceforth
referred to as $OPENJDK_HOME. )
Because, JDK1.6 has no language level changes from JDK1.5, I expected
JastAddJ can compile .java source files in OpenJDK1.6.
(2)
I copied some .java files from $OPENJDK_HOME/jdk/src/share/classes and from
$OPENJDK_HOME/build/linux-i586/gensrc
to another directory (let’s call it $LOCAL).
And compiled the .java files one by one with javac and verified that
they are well compiled with javac (from Sun JDK 1.6.0) using the following
simple shell script.
( I should confess that I’m still not good at using ant. )
-=-=-=-=
for i in $(find . -name *.java)
do
echo "### compiling $i"
javac -bootclasspath .:./build:/$OPENJDK_HOME/build/linux-i586/classes
-extdirs . -cp . -d build $i
echo "### result = $?, compiling $i"
done
-=-=-=-=
Then, I got 7638 .java files which are well compiled with javac.
(3)
Then, I tried to compile the .java files with JastAddJ with the following
shell script which is almost the same as the above one.
-=-=-=-=
for i in $(find . -name *.java)
do
echo "### compiling $i"
java -cp /home/hina/install/JastAddJ/Java1.5Backend JavaCompiler
-bootclasspath .:./build:$OPENJDK_HOME/build/linux-i586/classes -extdirs .
-classpath . -d build $i
echo "### result = $?, compiling $i"
done
-=-=-=-=
Then, I found that 1039 .java files are well compiled, but that 6599 files
are not.
Fortunately, the error messages are divided into only 3 types,
so I guess that I can compile them all if I figure out the causes of 3 types
of errors.
Because I’m planning to work seriously with JastAddJ, I have to understand
it thoroughly.
So, figuring out the causes of errors will be a good exercise for me.
But, I guess that this result and the three types of errors can be
interesting for JastAddJ developers.
The first type of error occurred only when I compiled
$LOCAL/org/jcp/xml/dsig/internal/MacOutputStream.java
The message says
-=-=-=-=
… (many warnings about deprecated features.)
Errors:
java/security/KeyStore.java:1668:
Semantic Error: new Builder() {
private volatile boolean getCalled;
private IOException oldException;
private final PrivilegedExceptionAction<KeyStore> action = new
PrivilegedExceptionAction<KeyStore>() {
public KeyStore run() throws Exception {
KeyStore ks;
if(provider == null) {
ks = KeyStore.getInstance(type);
}
else {
ks = KeyStore.getInstance(type, provider);
}
LoadStoreParameter param = new
SimpleLoadStoreParameter(protection);
if(protection instanceof CallbackHandlerProtection == false)
{
ks.load(param);
}
else {
int tries = 0;
while(true){
tries++;
try {
ks.load(param);
break ;
}
catch (IOException e) {
if(e.getCause() instanceof UnrecoverableKeyException)
{
if(tries < MAX_CALLBACK_TRIES) {
continue ;
}
else {
oldException = e;
}
}
throw e;
}
}
}
getCalled = true;
return ks;
}
};
public synchronized KeyStore getKeyStore() throws
KeyStoreException {
if(oldException != null) {
throw new KeyStoreException("Previous KeyStore instantiation
failed", oldException);
}
try {
return AccessController.doPrivileged(action);
}
catch (PrivilegedActionException e) {
Throwable cause = e.getCause();
throw new KeyStoreException("KeyStore instantiation failed",
cause);
}
}
public ProtectionParameter getProtectionParameter(String alias) {
if(alias == null) {
throw new NullPointerException();
}
if(getCalled == false) {
throw new IllegalStateException("getKeyStore() must be called
first");
}
return protection;
}
} may throw uncaught exception java.io.IOException; it must be caught
or declared as being thrown
…
-=-=-=-=
The second type of error messages occurred for 6370 .java files, and say,
for example,
-=-=-=-=
### compiling ./java/lang/Void.java ( ß This is from my shell script )
Exception in thread "main" java.lang.Error: Expected : but found
;>(Ljava/lang/Class<TU;>;)Ljava/lang/Class<+TU;>;
at AST.Signatures.error(Signatures.java:53)
at AST.Signatures.eat(Signatures.java:46)
at AST.Signatures.classBound(Signatures.java:213)
at AST.Signatures.formalTypeParameter(Signatures.java:199)
at AST.Signatures.formalTypeParameters(Signatures.java:189)
at AST.Signatures$MethodSignature.methodTypeSignature(Signatures.java:133)
at AST.Signatures$MethodSignature.<init>(Signatures.java:129)
at AST.Attributes$MethodAttributes.processAttribute(Attributes.java:186)
at AST.Attributes.attributes(Attributes.java:55)
at AST.Attributes$MethodAttributes.<init>(Attributes.java:173)
at AST.MethodInfo.<init>(MethodInfo.java:52)
at AST.BytecodeParser.parseMethods(BytecodeParser.java:531)
at AST.BytecodeParser.parse(BytecodeParser.java:329)
at AST.BytecodeParser.read(BytecodeParser.java:21)
at AST.PathPart.getCompilationUnit(PathPart.java:109)
at AST.Program.getCompilationUnit(Program.java:257)
at AST.Program.lookupType_compute(Program.java:1304)
at AST.Program.lookupType(Program.java:1285)
at AST.Program.Define_TypeDecl_lookupType(Program.java:1779)
at AST.ASTNode.Define_TypeDecl_lookupType(ASTNode.java:1588)
at AST.CompilationUnit.lookupType(CompilationUnit.java:926)
at
AST.CompilationUnit.refined_TypeScopePropagation_CompilationUnit_Child_looku
pType_String(CompilationUnit.java:555)
at
AST.CompilationUnit.Define_SimpleSet_lookupType(CompilationUnit.java:1023)
at AST.ASTNode.Define_SimpleSet_lookupType(ASTNode.java:1594)
at AST.TypeDecl.lookupType(TypeDecl.java:6893)
at AST.TypeDecl.Define_SimpleSet_lookupType(TypeDecl.java:7435)
at AST.ASTNode.Define_SimpleSet_lookupType(ASTNode.java:1594)
at AST.ASTNode.Define_SimpleSet_lookupType(ASTNode.java:1594)
at AST.ASTNode.Define_SimpleSet_lookupType(ASTNode.java:1594)
at AST.AbstractDot.Define_SimpleSet_lookupType(AbstractDot.java:915)
at AST.Expr.lookupType(Expr.java:1279)
at AST.AmbiguousAccess.rewriteRule0(AmbiguousAccess.java:268)
at AST.AmbiguousAccess.rewriteTo(AmbiguousAccess.java:253)
at AST.ASTNode.getChild(ASTNode.java:752)
at AST.ASTNode.getChild(ASTNode.java:731)
at AST.Dot.getLeft(Dot.java:170)
at AST.AbstractDot.leftSide_compute(AbstractDot.java:569)
at AST.AbstractDot.leftSide(AbstractDot.java:563)
at AST.Dot.rewriteTo(Dot.java:211)
at AST.ASTNode.getChild(ASTNode.java:752)
at AST.ASTNode.getChild(ASTNode.java:731)
at AST.FieldDeclaration.getInit(FieldDeclaration.java:646)
at AST.FieldDeclaration.typeCheck(FieldDeclaration.java:292)
at AST.ASTNode.collectErrors(ASTNode.java:291)
at AST.ASTNode.collectErrors(ASTNode.java:298)
at AST.ASTNode.collectErrors(ASTNode.java:298)
at AST.ASTNode.collectErrors(ASTNode.java:298)
at AST.ASTNode.collectErrors(ASTNode.java:298)
at AST.CompilationUnit.errorCheck(CompilationUnit.java:174)
at AST.Frontend.process(Frontend.java:65)
at JavaCompiler.compile(JavaCompiler.java:19)
at JavaCompiler.main(JavaCompiler.java:14)
### result = 1, compiling ./java/lang/Void.java
-=-=-=-=
The strings after the “but found ;>” and the call stacks vary for source
files.
(Therefore, it is possible that they are not due to a single bug. )
The third type of error messages occurred for the remaining 228 source
files,
and are almost the same as the second one, but says
“… Expected ; but found …” instead of “… Expected : but found …”
(that is, semicolons instead of colons).
If the above phenomena are caused due to my mistakes, please let me know.
Thank you.
-- Hyunik
Received on Thu Nov 24 2011 - 12:21:09 CET