Import von generischen Klassen #207
Labels
No Label
Codegen
confirmed
duplicate
Eclipse-Plugin
Feature Request
generics
in progress
invalid
JavaCompilerCore
needs info
Parser
Trash
Type
Unify
won't fix
works for me
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: JavaTX/JavaCompilerCore#207
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
commit
c1c12fa33c
(HEAD -> addPackages, origin/addPackages)Beim Test mathStrucVectorTest.java erhält man folgenden Bug:
java.lang.ClassCastException: de.dhbwstuttgart.syntaxtree.type.GenericRefType cannot be cast to de.dhbwstuttgart.syntaxtree.type.RefType
at de.dhbwstuttgart.syntaxtree.factory.ASTFactory.createGeneric(ASTFactory.java:196)
at de.dhbwstuttgart.syntaxtree.factory.ASTFactory.createGenerics(ASTFactory.java:135)
at de.dhbwstuttgart.syntaxtree.factory.ASTFactory.createClass(ASTFactory.java:65)
at de.dhbwstuttgart.core.JavaTXCompiler.getAvailableClasses(JavaTXCompiler.java:138)
at de.dhbwstuttgart.core.JavaTXCompiler.typeInference(JavaTXCompiler.java:463)
at packages.mathStrucVectorTest.testSetPackageNameInBytecodeAndOutputFolder(mathStrucVectorTest.java:42)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at junit.framework.TestCase.runTest(TestCase.java:176)
at junit.framework.TestCase.runBare(TestCase.java:141)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:252)
at junit.framework.TestSuite.run(TestSuite.java:247)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:40)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:430)
at org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:80)
at org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:71)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:229)
at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:197)
at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:211)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:191)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:137)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.run(JUnit5TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
Fixed mit commit:
f59a7d221e
auf branch addPackages
Es compiliert korrekt. Allerdimngs der Aufruf (aus dem normalen Java) klappt noch nicht.
Mit der Datei mathStrucVectorUse.java:
package de.test;
import de.test.mathStrucVector;
class mathStrucVectorUse {
}
erhalte ich die Fehlermeldung
Bist du sicher, dass das ein Problem mit den Packages ist?
Ändert man die Klasse vectorAdd zu der leeren Klasse
package de.test;
class vectorAdd {
}
also löscht das add-Feld und ändert die Datei mathStrucVector.jav zu:
package de.test;
import java.util.Vector;
import java.lang.Integer;
import java.lang.Boolean;
import de.test.vectorAdd;
class mathStrucVector {
}
Dann lässt sich der Test problemlos ausführen. Ich glaube nicht, dass es ein Problem bei der Namensauflösung gibt. Java sagt zwar NoClassDefFoundError aber ich denke, das liegt daran, dass am bytecode der Klasse etwas nicht stimmt und das Problem daher in der Bytecodegenerierung liegt.