JLang
JLang copied to clipboard
java.awt is not implemented?
Hello. I tried build HelloWorld and it works. Ok. Now I try compile HelloAwt. Source: `import java.awt.Frame; import java.awt.event.WindowEvent; import java.awt.event.WindowListener;
public class HelloAwt {
static class FrameWin extends Frame implements WindowListener {
public FrameWin (String FrameTitle) {
super (FrameTitle);
addWindowListener ((WindowListener) this);
}
@Override
public void windowOpened (WindowEvent e) {}
@Override
public void windowClosing (WindowEvent e) {
this.dispose ();
}
@Override
public void windowClosed (WindowEvent e) {}
@Override
public void windowIconified (WindowEvent e) {}
@Override
public void windowDeiconified (WindowEvent e) {}
@Override
public void windowActivated (WindowEvent e) {}
@Override
public void windowDeactivated (WindowEvent e) {}
}
public static void main (String [] args) {
FrameWin frame = new FrameWin ("test awt window");
frame.setSize (640, 480);
frame.setResizable (false);
frame.setLocationRelativeTo (null);
frame.setVisible (true);
}
} `
I ran command: ./bin/jlangc -cp jdk/out/classes HelloAwt.java
and it builded HelloAwt.ll
After I ran ./bin/compile_ll.sh HelloAwt.ll
and it crash: [log] (https://pastebin.com/2ez2QcFB) ("неопределённая ссылка" translate as "undefined link")
Awt it is not implemented part?
Hi,
We have not implemented support for all of the JDK libraries in JLang's JVM runtime API yet. Therefore, we only compile a small subset of the JDK when building the JLang JDK runtime, and we don't compile all of the supported JDK classes.
I have not tested the awt
libraries yet and I don't know if they are supported by JLang,
but you can test this yourself by adding the following import statements to <jlang_top_dir>/jdk/Main.java
and rebuilding.
import java.awt.Frame;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
We plan to improve the infrastructure for compiling the JDK libraries in the future.
Edit: I just tested compiling the JDK awt
libraries and it currently fails in JLang. I'll use this issue to track that bug.
Error when compiling awt
libs:
java.awt.Window.AccessibleAWTWindow() cannot be invoked with arguments
(java.awt.Frame).
protected class AccessibleAWTFrame extends AccessibleAWTWindow
^
1 error.
Exception in thread "main" polyglot.util.InternalCompilerError: /Users/drew/poly/JLang/jdk/src/java/awt/Frame.java:1284,14-14: Constructor java.awt.Window.AccessibleAWTWindow() cannot be invoked with arguments (java.awt.Frame).
at jlang.util.TypedNodeFactory.ConstructorCall(TypedNodeFactory.java:207)
at jlang.visit.SubstituteEnclosingInstances.leaveDesugar(DesugarInnerClasses.java:180)
at jlang.visit.DesugarVisitor.leaveDesugar(DesugarVisitor.java:137)
at jlang.visit.DesugarVisitor.leave(DesugarVisitor.java:96)
at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:304)
at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:261)
at polyglot.ast.Node_c.visitChild(Node_c.java:247)
at polyglot.ast.Node_c.visitList(Node_c.java:305)
at polyglot.ast.AbstractBlock_c.visitChildren(AbstractBlock_c.java:106)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:296)
at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:261)
at polyglot.ast.Node_c.visitChild(Node_c.java:247)
at polyglot.ast.ConstructorDecl_c.visitChildren(ConstructorDecl_c.java:132)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ext.jl5.ast.JL5AnnotatedElementExt.visitChildren(JL5AnnotatedElementExt.java:85)
at polyglot.ext.jl5.ast.JL5ProcedureDeclExt.visitChildren(JL5ProcedureDeclExt.java:112)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:296)
at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:261)
at polyglot.ast.Node_c.visitChild(Node_c.java:247)
at polyglot.ast.Node_c.visitList(Node_c.java:305)
at polyglot.ast.ClassBody_c.visitChildren(ClassBody_c.java:106)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:296)
at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:261)
at polyglot.ast.Node_c.visitChild(Node_c.java:247)
at polyglot.ast.ClassDecl_c.visitChildren(ClassDecl_c.java:276)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ext.jl5.ast.JL5AnnotatedElementExt.visitChildren(JL5AnnotatedElementExt.java:85)
at polyglot.ext.jl5.ast.JL5ClassDeclExt.visitChildren(JL5ClassDeclExt.java:163)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:296)
at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:261)
at polyglot.ast.Node_c.visitChild(Node_c.java:247)
at polyglot.ast.Node_c.visitList(Node_c.java:305)
at polyglot.ast.ClassBody_c.visitChildren(ClassBody_c.java:106)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:296)
at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:261)
at polyglot.ast.Node_c.visitChild(Node_c.java:247)
at polyglot.ast.ClassDecl_c.visitChildren(ClassDecl_c.java:276)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ext.jl5.ast.JL5AnnotatedElementExt.visitChildren(JL5AnnotatedElementExt.java:85)
at polyglot.ext.jl5.ast.JL5ClassDeclExt.visitChildren(JL5ClassDeclExt.java:163)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:296)
at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:261)
at polyglot.ast.Node_c.visitChild(Node_c.java:247)
at polyglot.ast.Node_c.visitList(Node_c.java:305)
at polyglot.ast.SourceFile_c.visitChildren(SourceFile_c.java:185)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.ast.Ext_c.visitChildren(Ext_c.java:173)
at polyglot.ast.JLang_c.visitChildren(JLang_c.java:112)
at polyglot.visit.NodeVisitor.visitEdgeNoOverride(NodeVisitor.java:296)
at polyglot.visit.NodeVisitor.visitEdge(NodeVisitor.java:261)
at polyglot.ast.Node_c.visit(Node_c.java:252)
at polyglot.frontend.VisitorPass.run(VisitorPass.java:81)
at jlang.visit.DesugarInnerClasses$1.run(DesugarInnerClasses.java:62)
at jlang.util.JLangDesugared$1.run(JLangDesugared.java:124)
at polyglot.frontend.Scheduler.runPass(Scheduler.java:640)
at polyglot.frontend.Scheduler.runGoal(Scheduler.java:530)
at polyglot.frontend.Scheduler.attemptGoal(Scheduler.java:475)
at polyglot.frontend.Scheduler.attemptGoal(Scheduler.java:448)
at polyglot.frontend.Scheduler.attemptGoal(Scheduler.java:448)
at polyglot.frontend.Scheduler.attemptGoal(Scheduler.java:448)
at polyglot.frontend.Scheduler.attemptGoal(Scheduler.java:399)
at polyglot.frontend.Scheduler.runToCompletion(Scheduler.java:331)
at polyglot.ext.jl5.JL5Scheduler.runToCompletion(JL5Scheduler.java:335)
at polyglot.frontend.Compiler.runToGoal(Compiler.java:237)
at polyglot.frontend.Compiler.compile(Compiler.java:189)
at polyglot.frontend.Compiler.compileFiles(Compiler.java:179)
at polyglot.main.Main.start(Main.java:182)
at polyglot.main.Main.start(Main.java:138)
at jlang.Main.main(Main.java:16)
Caused by: polyglot.types.NoMemberException: Constructor java.awt.Window.AccessibleAWTWindow() cannot be invoked with arguments (java.awt.Frame).```