Fix for Bug 230
This commit is contained in:
parent
33e9b87562
commit
8f7becd62d
6
pom.xml
6
pom.xml
@ -118,7 +118,7 @@ http://maven.apache.org/maven-v4_0_0.xsd">
|
|||||||
</descriptorRefs>
|
</descriptorRefs>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
@ -129,8 +129,8 @@ http://maven.apache.org/maven-v4_0_0.xsd">
|
|||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>18</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>18</maven.compiler.target>
|
||||||
<tycho.version>0.23.0</tycho.version>
|
<tycho.version>0.23.0</tycho.version>
|
||||||
<mainClass>de.dhbwstuttgart.core.ConsoleInterface</mainClass>
|
<mainClass>de.dhbwstuttgart.core.ConsoleInterface</mainClass>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -39,7 +39,7 @@ public class FieldAssumption extends Assumption{
|
|||||||
for(GenericTypeVar gtv : receiverClass.getGenerics()){
|
for(GenericTypeVar gtv : receiverClass.getGenerics()){
|
||||||
//Hier wird ein GenericRefType gebildet, welcher einen für dieses Feld eindeutigen Namen hat
|
//Hier wird ein GenericRefType gebildet, welcher einen für dieses Feld eindeutigen Namen hat
|
||||||
GenericRefType genericRefType =
|
GenericRefType genericRefType =
|
||||||
new GenericRefType(receiverClass.getClassName().toString() + " " + name + " " + gtv.getName()
|
new GenericRefType(gtv.getName()
|
||||||
, new NullToken());
|
, new NullToken());
|
||||||
//Dieser wird dann korrekt aufgelöst vom Resolver:
|
//Dieser wird dann korrekt aufgelöst vom Resolver:
|
||||||
params.add(resolver.resolve(genericRefType));
|
params.add(resolver.resolve(genericRefType));
|
||||||
|
@ -47,7 +47,7 @@ public class TypeInferenceInformation {
|
|||||||
for(Field m : cl.getFieldDecl()){
|
for(Field m : cl.getFieldDecl()){
|
||||||
if(m.getName().equals(name)){
|
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)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,10 @@ public class JavaTXCompilerTest {
|
|||||||
execute(new File(rootDirectory+"Import.jav"));
|
execute(new File(rootDirectory+"Import.jav"));
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
|
public void fieldTest() throws IOException, ClassNotFoundException {
|
||||||
|
execute(new File(rootDirectory+"FieldAccess.jav"));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
public void lambda() throws IOException, ClassNotFoundException {
|
public void lambda() throws IOException, ClassNotFoundException {
|
||||||
execute(new File(rootDirectory+"Lambda.jav"));
|
execute(new File(rootDirectory+"Lambda.jav"));
|
||||||
}
|
}
|
||||||
|
13
src/test/resources/javFiles/FieldAccess.jav
Normal file
13
src/test/resources/javFiles/FieldAccess.jav
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user