forked from JavaTX/JavaCompilerCore
Merge branch 'bytecode2' of ssh://abualia@gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bytecode2
This commit is contained in:
commit
588b9ef83a
4
pom.xml
4
pom.xml
@ -7,7 +7,7 @@ http://maven.apache.org/maven-v4_0_0.xsd">
|
|||||||
<artifactId>JavaTXcompiler</artifactId>
|
<artifactId>JavaTXcompiler</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<version>0.1</version>
|
<version>0.2</version>
|
||||||
<name>JavaTXcompiler</name>
|
<name>JavaTXcompiler</name>
|
||||||
<url>http://maven.apache.org</url>
|
<url>http://maven.apache.org</url>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -127,7 +127,7 @@ http://maven.apache.org/maven-v4_0_0.xsd">
|
|||||||
<!-- specify your depencies here -->
|
<!-- specify your depencies here -->
|
||||||
<!-- groupId:artifactId:version -->
|
<!-- groupId:artifactId:version -->
|
||||||
<artifact>
|
<artifact>
|
||||||
<id>de.dhbwstuttgart:JavaTXcompiler:0.1</id>
|
<id>de.dhbwstuttgart:JavaTXcompiler:0.2</id>
|
||||||
</artifact>
|
</artifact>
|
||||||
<artifact>
|
<artifact>
|
||||||
<id>org.reflections:reflections:0.9.11</id>
|
<id>org.reflections:reflections:0.9.11</id>
|
||||||
|
@ -60,6 +60,11 @@ public class JavaTXCompiler {
|
|||||||
public final Map<File, SourceFile> sourceFiles = new HashMap<>();
|
public final Map<File, SourceFile> sourceFiles = new HashMap<>();
|
||||||
Boolean log = true; //gibt an ob ein Log-File nach System.getProperty("user.dir")+"src/test/java/logFiles" geschrieben werden soll?
|
Boolean log = true; //gibt an ob ein Log-File nach System.getProperty("user.dir")+"src/test/java/logFiles" geschrieben werden soll?
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Äußerste Liste der Source-Files.
|
||||||
|
* Danach Liste der Klassen in Source File.
|
||||||
|
* Danach Map Klassenname
|
||||||
|
*/
|
||||||
private List<List<HashMap<String, SimplifyResult>>> simplifyResultsSF = new ArrayList<>();
|
private List<List<HashMap<String, SimplifyResult>>> simplifyResultsSF = new ArrayList<>();
|
||||||
|
|
||||||
public JavaTXCompiler(File sourceFile) throws IOException, ClassNotFoundException {
|
public JavaTXCompiler(File sourceFile) throws IOException, ClassNotFoundException {
|
||||||
|
@ -225,12 +225,15 @@ public class UnifyTypeFactory {
|
|||||||
return new PairTPHequalRefTypeOrWildcardType((TypePlaceholder)tl, (RefType) tr);
|
return new PairTPHequalRefTypeOrWildcardType((TypePlaceholder)tl, (RefType) tr);
|
||||||
}else if(tr instanceof WildcardType){
|
}else if(tr instanceof WildcardType){
|
||||||
return new PairTPHequalRefTypeOrWildcardType((TypePlaceholder)tl, (WildcardType) tr);
|
return new PairTPHequalRefTypeOrWildcardType((TypePlaceholder)tl, (WildcardType) tr);
|
||||||
|
}else if(tr instanceof GenericRefType){
|
||||||
|
return new PairTPHequalRefTypeOrWildcardType((TypePlaceholder)tl, (GenericRefType) tr);
|
||||||
}else throw new NotImplementedException();
|
}else throw new NotImplementedException();
|
||||||
}else throw new NotImplementedException();
|
}else throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RefTypeOrTPHOrWildcardOrGeneric convert(ReferenceType t, Map<String,TypePlaceholder> tphs) {
|
public static RefTypeOrTPHOrWildcardOrGeneric convert(ReferenceType t, Map<String,TypePlaceholder> tphs) {
|
||||||
if(JavaClassName.Void.equals(t.getName()))return new Void(new NullToken());
|
if(JavaClassName.Void.equals(t.getName()))return new Void(new NullToken());
|
||||||
|
if (t.isGenTypeVar()) return new GenericRefType(t.getName(),new NullToken());
|
||||||
RefType ret = new RefType(new JavaClassName(t.getName()),convert(t.getTypeParams(), tphs),new NullToken());
|
RefType ret = new RefType(new JavaClassName(t.getName()),convert(t.getTypeParams(), tphs),new NullToken());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package de.dhbwstuttgart.typedeployment;
|
package de.dhbwstuttgart.typedeployment;
|
||||||
|
|
||||||
import org.antlr.v4.runtime.Token;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ public class TypeInsertFactory {
|
|||||||
ResolvedType resolvedType = resultSet.resolveType(type);
|
ResolvedType resolvedType = resultSet.resolveType(type);
|
||||||
TypeInsertPoint insertPoint = new TypeInsertPoint(offset,
|
TypeInsertPoint insertPoint = new TypeInsertPoint(offset,
|
||||||
new TypeToInsertString(resolvedType.resolvedType).insert);
|
new TypeToInsertString(resolvedType.resolvedType).insert);
|
||||||
return new TypeInsert(insertPoint, new HashSet<>(Arrays.asList(createGenericInsert(resolvedType.additionalGenerics, cl, m))));
|
return new TypeInsert(insertPoint, new HashSet<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TypeInsertPoint createGenericInsert(Set<GenericInsertPair> toInsert, ClassOrInterface cl, Method m){
|
private static TypeInsertPoint createGenericInsert(Set<GenericInsertPair> toInsert, ClassOrInterface cl, Method m){
|
||||||
|
@ -8,7 +8,7 @@ import java.util.List;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class TypeInsertPoint {
|
public class TypeInsertPoint {
|
||||||
public final Token point;
|
public Token point;
|
||||||
private String insertString;
|
private String insertString;
|
||||||
|
|
||||||
public TypeInsertPoint(Token point, String toInsert){
|
public TypeInsertPoint(Token point, String toInsert){
|
||||||
@ -28,6 +28,14 @@ public class TypeInsertPoint {
|
|||||||
return insertString;
|
return insertString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Token getToken() {
|
||||||
|
return this.point;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToken(Token point) {
|
||||||
|
this.point = point;
|
||||||
|
}
|
||||||
|
|
||||||
/* PL 2018-06-19
|
/* PL 2018-06-19
|
||||||
* Zwei TypeInsertPoint's sind gleich, wenn ihre point's gleich sind
|
* Zwei TypeInsertPoint's sind gleich, wenn ihre point's gleich sind
|
||||||
* eingefuegt damit man TypeReplaceMarker vergleichen kann
|
* eingefuegt damit man TypeReplaceMarker vergleichen kann
|
||||||
|
@ -11,28 +11,45 @@ import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor;
|
|||||||
* @author Florian Steurer
|
* @author Florian Steurer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class ReferenceType extends UnifyType {
|
public class ReferenceType extends UnifyType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The buffered hashCode
|
* The buffered hashCode
|
||||||
*/
|
*/
|
||||||
private final int hashCode;
|
private final int hashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gibt an, ob der ReferenceType eine generische Typvariable ist
|
||||||
|
*/
|
||||||
|
private final boolean genericTypeVar;
|
||||||
|
|
||||||
|
|
||||||
public <T> UnifyType accept(UnifyTypeVisitor<T> visitor, T ht) {
|
public <T> UnifyType accept(UnifyTypeVisitor<T> visitor, T ht) {
|
||||||
return visitor.visit(this, ht);
|
return visitor.visit(this, ht);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ReferenceType(String name) {
|
||||||
|
super(name, new TypeParams());
|
||||||
|
hashCode = 31 + 17 * typeName.hashCode() + 17 * typeParams.hashCode();
|
||||||
|
genericTypeVar = true;
|
||||||
|
}
|
||||||
|
|
||||||
public ReferenceType(String name, UnifyType... params) {
|
public ReferenceType(String name, UnifyType... params) {
|
||||||
super(name, new TypeParams(params));
|
super(name, new TypeParams(params));
|
||||||
hashCode = 31 + 17 * typeName.hashCode() + 17 * typeParams.hashCode();
|
hashCode = 31 + 17 * typeName.hashCode() + 17 * typeParams.hashCode();
|
||||||
|
genericTypeVar = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReferenceType(String name, TypeParams params) {
|
public ReferenceType(String name, TypeParams params) {
|
||||||
super(name, params);
|
super(name, params);
|
||||||
hashCode = 31 + 17 * typeName.hashCode() + 17 * typeParams.hashCode();
|
hashCode = 31 + 17 * typeName.hashCode() + 17 * typeParams.hashCode();
|
||||||
|
genericTypeVar = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isGenTypeVar () {
|
||||||
|
return genericTypeVar;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Set<UnifyType> smArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
|
Set<UnifyType> smArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
|
||||||
return fc.smArg(this, fBounded);
|
return fc.smArg(this, fBounded);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
package bytecode;
|
package bytecode;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
public class Id {
|
public class Id {
|
||||||
|
|
||||||
id(b){
|
<A> id(A b){
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user