Fixup
This commit is contained in:
parent
bebfba864e
commit
d940866c9f
@ -68,7 +68,7 @@ public class Typinferenz {
|
|||||||
|
|
||||||
// Keine Exception bei leerem Editor
|
// Keine Exception bei leerem Editor
|
||||||
if (Strings.isNullOrEmpty(editor.getSourceCode())) {
|
if (Strings.isNullOrEmpty(editor.getSourceCode())) {
|
||||||
return new UnifyResultModel(new ConstraintSet<>(), new FiniteClosure(new HashSet<>(), new OutputStreamWriter(new NullOutputStream())));
|
return new UnifyResultModel(new ConstraintSet<>(), new FiniteClosure(new HashSet<>(), new OutputStreamWriter(new NullOutputStream()), compiler));
|
||||||
}
|
}
|
||||||
return compiler.typeInferenceAsync(resultListener, new OutputStreamWriter(new NullOutputStream()));
|
return compiler.typeInferenceAsync(resultListener, new OutputStreamWriter(new NullOutputStream()));
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
@ -96,7 +96,7 @@ public class Typinferenz {
|
|||||||
for (SourceFile sf : compiler.sourceFiles.values()) {
|
for (SourceFile sf : compiler.sourceFiles.values()) {
|
||||||
try {
|
try {
|
||||||
var generatedClasses = compiler.generateBytecode(sf, tiResults);
|
var generatedClasses = compiler.generateBytecode(sf, tiResults);
|
||||||
compiler.writeClassFile(generatedClasses, new File(outputDirectory));
|
compiler.writeClassFile(generatedClasses, new File(outputDirectory), false);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
ErrorMarker toAdd = new ErrorMarker(ex.getMessage(), new CodePoint(sf.getOffset()));
|
ErrorMarker toAdd = new ErrorMarker(ex.getMessage(), new CodePoint(sf.getOffset()));
|
||||||
ret.add(toAdd);
|
ret.add(toAdd);
|
||||||
|
@ -12,6 +12,7 @@ import de.dhbwstuttgart.syntaxtree.AbstractASTWalker;
|
|||||||
import de.dhbwstuttgart.syntaxtree.Field;
|
import de.dhbwstuttgart.syntaxtree.Field;
|
||||||
import de.dhbwstuttgart.syntaxtree.FormalParameter;
|
import de.dhbwstuttgart.syntaxtree.FormalParameter;
|
||||||
import de.dhbwstuttgart.syntaxtree.ParameterList;
|
import de.dhbwstuttgart.syntaxtree.ParameterList;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.Pattern;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.FieldVar;
|
import de.dhbwstuttgart.syntaxtree.statement.FieldVar;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.LocalVar;
|
import de.dhbwstuttgart.syntaxtree.statement.LocalVar;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.LocalVarDecl;
|
import de.dhbwstuttgart.syntaxtree.statement.LocalVarDecl;
|
||||||
@ -102,13 +103,15 @@ public class IdentifierFinder extends AbstractASTWalker implements ASTVisitor, R
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visit(ParameterList formalParameters) {
|
public void visit(ParameterList formalParameters) {
|
||||||
for (FormalParameter fp : formalParameters) {
|
for (Pattern pat : formalParameters) {
|
||||||
if (fp.getName().equals(identifier)) {
|
if (pat instanceof FormalParameter fp) {
|
||||||
this.result = fp.getType();
|
if (fp.getName().equals(identifier)) {
|
||||||
if (fp.getType() instanceof TypePlaceholder) {
|
this.result = fp.getType();
|
||||||
((TypePlaceholder)fp.getType()).accept((ASTVisitor)this);
|
if (fp.getType() instanceof TypePlaceholder) {
|
||||||
} else if (fp.getType() instanceof RefType) {
|
((TypePlaceholder)fp.getType()).accept((ASTVisitor)this);
|
||||||
((RefType)fp.getType()).accept((ASTVisitor)this);
|
} else if (fp.getType() instanceof RefType) {
|
||||||
|
((RefType)fp.getType()).accept((ASTVisitor)this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public class JafCompletionProcessor implements IContentAssistProcessor {
|
|||||||
Set<String> fieldNames = new TreeSet<>();
|
Set<String> fieldNames = new TreeSet<>();
|
||||||
|
|
||||||
//LOG.log(new Status(WARNING, PLUGIN_ID,"New path for classpath: " + editor.getFilePath().toFile().getAbsolutePath()));
|
//LOG.log(new Status(WARNING, PLUGIN_ID,"New path for classpath: " + editor.getFilePath().toFile().getAbsolutePath()));
|
||||||
ClassLoader additionalCP = addPath(editor.getFilePath().toFile().getParentFile());
|
ClassLoader additionalCP = addPath(new File(editor.getFilePath().toFile().getParentFile(), "classFiles"));
|
||||||
|
|
||||||
for (String prop : editor.resolveTypeInserts(prefix, evaluateLineNumber(doc, offset))) {
|
for (String prop : editor.resolveTypeInserts(prefix, evaluateLineNumber(doc, offset))) {
|
||||||
if (prop.contains("<")) {
|
if (prop.contains("<")) {
|
||||||
|
@ -7,10 +7,14 @@ import de.dhbwstuttgart.parser.SyntaxTreeGenerator.AssignToLocal;
|
|||||||
import de.dhbwstuttgart.syntaxtree.ASTVisitor;
|
import de.dhbwstuttgart.syntaxtree.ASTVisitor;
|
||||||
import de.dhbwstuttgart.syntaxtree.ClassOrInterface;
|
import de.dhbwstuttgart.syntaxtree.ClassOrInterface;
|
||||||
import de.dhbwstuttgart.syntaxtree.Constructor;
|
import de.dhbwstuttgart.syntaxtree.Constructor;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.ExpressionPattern;
|
||||||
import de.dhbwstuttgart.syntaxtree.Field;
|
import de.dhbwstuttgart.syntaxtree.Field;
|
||||||
import de.dhbwstuttgart.syntaxtree.FormalParameter;
|
import de.dhbwstuttgart.syntaxtree.FormalParameter;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.Pattern;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.RecordPattern;
|
||||||
import de.dhbwstuttgart.syntaxtree.GenericDeclarationList;
|
import de.dhbwstuttgart.syntaxtree.GenericDeclarationList;
|
||||||
import de.dhbwstuttgart.syntaxtree.GenericTypeVar;
|
import de.dhbwstuttgart.syntaxtree.GenericTypeVar;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.GuardedPattern;
|
||||||
import de.dhbwstuttgart.syntaxtree.Method;
|
import de.dhbwstuttgart.syntaxtree.Method;
|
||||||
import de.dhbwstuttgart.syntaxtree.ParameterList;
|
import de.dhbwstuttgart.syntaxtree.ParameterList;
|
||||||
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
||||||
@ -20,11 +24,14 @@ import de.dhbwstuttgart.syntaxtree.statement.Assign;
|
|||||||
import de.dhbwstuttgart.syntaxtree.statement.AssignToField;
|
import de.dhbwstuttgart.syntaxtree.statement.AssignToField;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.BinaryExpr;
|
import de.dhbwstuttgart.syntaxtree.statement.BinaryExpr;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.Block;
|
import de.dhbwstuttgart.syntaxtree.statement.Block;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.statement.BoolExpression;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.statement.Break;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.CastExpr;
|
import de.dhbwstuttgart.syntaxtree.statement.CastExpr;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.DoStmt;
|
import de.dhbwstuttgart.syntaxtree.statement.DoStmt;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.EmptyStmt;
|
import de.dhbwstuttgart.syntaxtree.statement.EmptyStmt;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.ExpressionReceiver;
|
import de.dhbwstuttgart.syntaxtree.statement.ExpressionReceiver;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.FieldVar;
|
import de.dhbwstuttgart.syntaxtree.statement.FieldVar;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.statement.ForEachStmt;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.ForStmt;
|
import de.dhbwstuttgart.syntaxtree.statement.ForStmt;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.IfStmt;
|
import de.dhbwstuttgart.syntaxtree.statement.IfStmt;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.InstanceOf;
|
import de.dhbwstuttgart.syntaxtree.statement.InstanceOf;
|
||||||
@ -42,9 +49,16 @@ import de.dhbwstuttgart.syntaxtree.statement.Statement;
|
|||||||
import de.dhbwstuttgart.syntaxtree.statement.StaticClassName;
|
import de.dhbwstuttgart.syntaxtree.statement.StaticClassName;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.Super;
|
import de.dhbwstuttgart.syntaxtree.statement.Super;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.SuperCall;
|
import de.dhbwstuttgart.syntaxtree.statement.SuperCall;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.statement.Switch;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.statement.SwitchBlock;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.statement.SwitchLabel;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.statement.Ternary;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.This;
|
import de.dhbwstuttgart.syntaxtree.statement.This;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.statement.ThisCall;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.statement.Throw;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.UnaryExpr;
|
import de.dhbwstuttgart.syntaxtree.statement.UnaryExpr;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.WhileStmt;
|
import de.dhbwstuttgart.syntaxtree.statement.WhileStmt;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.statement.Yield;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
|
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.GenericRefType;
|
import de.dhbwstuttgart.syntaxtree.type.GenericRefType;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||||
@ -53,6 +67,30 @@ import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
|||||||
|
|
||||||
public class ASTChildren implements ASTVisitor{
|
public class ASTChildren implements ASTVisitor{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(ForEachStmt forEachStmt) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(ThisCall thisCall) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(Throw aThrow) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(Ternary ternary) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private final List<SyntaxTreeNode> children = new ArrayList<>();
|
private final List<SyntaxTreeNode> children = new ArrayList<>();
|
||||||
|
|
||||||
public ASTChildren(SyntaxTreeNode ofNode) {
|
public ASTChildren(SyntaxTreeNode ofNode) {
|
||||||
@ -226,7 +264,7 @@ public class ASTChildren implements ASTVisitor{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visit(Method field) {
|
public void visit(Method field) {
|
||||||
for(FormalParameter fp : field.getParameterList().getFormalparalist()) {
|
for(Pattern fp : field.getParameterList().getFormalparalist()) {
|
||||||
children.add(fp);
|
children.add(fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -325,4 +363,54 @@ public class ASTChildren implements ASTVisitor{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(ExpressionPattern aPattern) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(RecordPattern aRecordPattern) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(GuardedPattern aGuardedPattern) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(BoolExpression logical) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(Switch switchStmt) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(SwitchBlock switchBlock) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(SwitchLabel switchLabel) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(Break aBreak) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visit(Yield aYield) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,11 @@
|
|||||||
<module>releng</module>
|
<module>releng</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>21</maven.compiler.source>
|
||||||
|
<maven.compiler.target>21</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<tycho.version>3.0.5</tycho.version>
|
<tycho.version>4.0.7</tycho.version>
|
||||||
<eclipse-repo.url>https://download.eclipse.org/eclipse/updates/4.28</eclipse-repo.url>
|
<eclipse-repo.url>https://download.eclipse.org/eclipse/updates/4.28</eclipse-repo.url>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<downloadSources>true</downloadSources>
|
<downloadSources>true</downloadSources>
|
||||||
@ -77,7 +77,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.dhbwstuttgart</groupId>
|
<groupId>de.dhbwstuttgart</groupId>
|
||||||
<artifactId>JavaTXcompiler</artifactId>
|
<artifactId>JavaTXcompiler</artifactId>
|
||||||
<version>0.1.0</version>
|
<version>0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.antlr</groupId>
|
<groupId>org.antlr</groupId>
|
||||||
|
Loading…
Reference in New Issue
Block a user