mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Co-authored-by: VGORDIEVSKII <vgordievskii@luxoft.com>
This commit is contained in:
parent
333ee95604
commit
6892c4f0ca
|
@ -16,6 +16,9 @@
|
|||
package org.teavm.classlib.impl;
|
||||
|
||||
import java.util.Properties;
|
||||
import org.teavm.interop.Export;
|
||||
import org.teavm.model.AnnotationContainer;
|
||||
import org.teavm.model.AnnotationHolder;
|
||||
import org.teavm.model.BasicBlock;
|
||||
import org.teavm.model.ClassHierarchy;
|
||||
import org.teavm.model.ClassHolder;
|
||||
|
@ -32,6 +35,8 @@ import org.teavm.model.instructions.PutFieldInstruction;
|
|||
|
||||
public class ScalaHacks implements ClassHolderTransformer {
|
||||
private static final String ATTR_NAME_CLASS = "java.util.jar.Attributes$Name";
|
||||
private static final String SCALA_INTERNAL_CLASS_MARKER = "$";
|
||||
|
||||
@Override
|
||||
public void transformClass(ClassHolder cls, ClassHolderTransformerContext context) {
|
||||
switch (cls.getName()) {
|
||||
|
@ -41,6 +46,12 @@ public class ScalaHacks implements ClassHolderTransformer {
|
|||
case "scala.util.Properties$":
|
||||
transformProperties(cls);
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if (cls.getName().endsWith(SCALA_INTERNAL_CLASS_MARKER)) {
|
||||
checkAndRemoveExportAnnotation(cls);
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,4 +97,14 @@ public class ScalaHacks implements ClassHolderTransformer {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAndRemoveExportAnnotation(ClassHolder cls) {
|
||||
for (MethodHolder method : cls.getMethods()) {
|
||||
AnnotationContainer items = method.getAnnotations();
|
||||
AnnotationHolder exportAnn = items.get(Export.class.getTypeName());
|
||||
if (exportAnn != null) {
|
||||
method.getAnnotations().remove(exportAnn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user