forked from JavaTX/JavaCompilerCore
Fix for Bug 230
This commit is contained in:
parent
33e9b87562
commit
8f7becd62d
4
pom.xml
4
pom.xml
@ -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>
|
||||
|
@ -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));
|
||||
|
@ -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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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"));
|
||||
}
|
||||
|
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