Skip to content

Commit

Permalink
Fix/Revert renaming teavm package
Browse files Browse the repository at this point in the history
  • Loading branch information
xpenatan committed Aug 6, 2024
1 parent a4eb312 commit d1cc9d9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ public void onParserComplete(JParser jParser, ArrayList<JParserItem> parserItems
boolean skipUnit = false;

if(!JParser.CREATE_IDL_HELPER) {
//TODO implement better class renaming
// Hack to look for idl classes that was generated with the main lib
ArrayList<String> baseIDLClasses = getBaseIDLClasses();
for(String baseIDLClass : baseIDLClasses) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,38 @@ public void onParserComplete(JParser jParser, ArrayList<JParserItem> parserItems
for(int i = 0; i < parserItems.size(); i++) {
JParserItem parserItem = parserItems.get(i);
CompilationUnit unit = parserItem.unit;
for(ImportDeclaration anImport : unit.getImports()) {
Name name = anImport.getName();
String importPath = "";
Optional<Name> qualifier = name.getQualifier();
if(qualifier.isPresent()) {
importPath = qualifier.get().asString();
}
String identifier = name.getIdentifier();

boolean skipUnit = false;
if(!JParser.CREATE_IDL_HELPER) {
//TODO implement better class renaming
// Hack to skip the generated lib and use the main one
ArrayList<String> baseIDLClasses = getBaseIDLClasses();
for(String baseIDLClass : baseIDLClasses) {
String[] split = baseIDLClass.split("\\.");
String s = split[split.length - 1];
if(s.equals(identifier)) {
skipUnit = true;
break;
}
}
}
if(!skipUnit) {
JParserItem parserUnitItem = jParser.getParserUnitItem(prefix + identifier);
if(parserUnitItem != null) {
String newImport = packagePrefix + importPath + ".";
anImport.setName(newImport + prefix + identifier);
}
}
}

PackageDeclaration packageDeclaration = unit.getPackageDeclaration().get();
String nameAsString1 = packageDeclaration.getNameAsString();
packageDeclaration.setName(packagePrefix + nameAsString1);
Expand Down

0 comments on commit d1cc9d9

Please sign in to comment.