Fix for Bug 230

This commit is contained in:
Andreas Stadelmeier 2022-10-03 10:08:50 +02:00
parent 33e9b87562
commit 8f7becd62d
5 changed files with 22 additions and 5 deletions

View File

@ -118,7 +118,7 @@ http://maven.apache.org/maven-v4_0_0.xsd">
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</plugins>
</build>
<repositories>
<repository>
@ -129,8 +129,8 @@ http://maven.apache.org/maven-v4_0_0.xsd">
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>18</maven.compiler.source>
<maven.compiler.target>18</maven.compiler.target>
<tycho.version>0.23.0</tycho.version>
<mainClass>de.dhbwstuttgart.core.ConsoleInterface</mainClass>
</properties>

View File

@ -39,7 +39,7 @@ public class FieldAssumption extends Assumption{
for(GenericTypeVar gtv : receiverClass.getGenerics()){
//Hier wird ein GenericRefType gebildet, welcher einen für dieses Feld eindeutigen Namen hat
GenericRefType genericRefType =
new GenericRefType(receiverClass.getClassName().toString() + " " + name + " " + gtv.getName()
new GenericRefType(gtv.getName()
, new NullToken());
//Dieser wird dann korrekt aufgelöst vom Resolver:
params.add(resolver.resolve(genericRefType));

View File

@ -47,7 +47,7 @@ public class TypeInferenceInformation {
for(Field m : cl.getFieldDecl()){
if(m.getName().equals(name)){
ret.add(new FieldAssumption(name, cl, checkGTV(m.getType()), new TypeScopeContainer(cl, m)));
ret.add(new FieldAssumption(name, cl, m.getType(), new TypeScopeContainer(cl, m)));
}
}
}

View File

@ -33,6 +33,10 @@ public class JavaTXCompilerTest {
execute(new File(rootDirectory+"Import.jav"));
}
@Test
public void fieldTest() throws IOException, ClassNotFoundException {
execute(new File(rootDirectory+"FieldAccess.jav"));
}
@Test
public void lambda() throws IOException, ClassNotFoundException {
execute(new File(rootDirectory+"Lambda.jav"));
}

View File

@ -0,0 +1,13 @@
class Box<A> {
A f;
}
class B {
}
class Box_Main extends B {
m(b) {
b.f = new Box_Main();
b.f = new B();
}
}