Fix #313
All checks were successful
Build and Test with Maven / Build-and-test-with-Maven (push) Successful in 2m43s
All checks were successful
Build and Test with Maven / Build-and-test-with-Maven (push) Successful in 2m43s
This commit is contained in:
parent
6b0816c1c4
commit
0b7f07108f
3
resources/packageTest/pkg/sub/Interface.jav
Normal file
3
resources/packageTest/pkg/sub/Interface.jav
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
package pkg.sub;
|
||||||
|
|
||||||
|
public interface Interface {}
|
@ -333,7 +333,7 @@ public class SyntaxTreeGenerator {
|
|||||||
|
|
||||||
private ClassOrInterface convertInterface(Java17Parser.InterfaceDeclarationContext ctx, int modifiers) {
|
private ClassOrInterface convertInterface(Java17Parser.InterfaceDeclarationContext ctx, int modifiers) {
|
||||||
this.superClass = new RefType(new JavaClassName("java.lang.Object"), new NullToken());
|
this.superClass = new RefType(new JavaClassName("java.lang.Object"), new NullToken());
|
||||||
String className = this.pkgName.length() > 0 ? this.pkgName + "." : "" + ctx.identifier().getText();
|
String className = (this.pkgName.length() > 0 ? this.pkgName + "." : "") + ctx.identifier().getText();
|
||||||
JavaClassName name = reg.getName(className); // Holt den Package Namen mit dazu
|
JavaClassName name = reg.getName(className); // Holt den Package Namen mit dazu
|
||||||
if (!name.toString().equals(className)) { // Kommt die Klasse schon in einem anderen Package vor?
|
if (!name.toString().equals(className)) { // Kommt die Klasse schon in einem anderen Package vor?
|
||||||
throw new TypeinferenceException("Name " + className + " bereits vorhanden in " + reg.getName(className).toString(), ctx.getStart());
|
throw new TypeinferenceException("Name " + className + " bereits vorhanden in " + reg.getName(className).toString(), ctx.getStart());
|
||||||
|
@ -34,4 +34,14 @@ public class TestPackages {
|
|||||||
|
|
||||||
cmp.generateBytecode(bytecodeDirectory);
|
cmp.generateBytecode(bytecodeDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPackageInterface() throws Exception {
|
||||||
|
var cmp = new JavaTXCompiler(
|
||||||
|
List.of(new File("resources/packageTest/pkg/sub/Interface.jav")),
|
||||||
|
List.of(new File("resources/packageTest"))
|
||||||
|
);
|
||||||
|
|
||||||
|
cmp.generateBytecode(bytecodeDirectory);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user