Skip to content
This repository has been archived by the owner on Mar 18, 2022. It is now read-only.

Commit

Permalink
Workarounds for IDL generation using ASM classes
Browse files Browse the repository at this point in the history
  • Loading branch information
russgold committed Jan 17, 2018
1 parent 388b37e commit b922369
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion rmic/src/main/java/org/glassfish/rmic/iiop/IDLNames.java
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public static String getClassOrInterfaceName (Identifier id,

// 28.3.2.5 Inner classes...

result = replace(typeName,". ","__");
result = toInnerClassName(typeName);

// 28.3.2.4 Illegal identifier characters...

Expand All @@ -284,6 +284,13 @@ public static String getClassOrInterfaceName (Identifier id,
return result;
}

private static String toInnerClassName(String typeName) {
if (typeName.contains(". "))
return replace(typeName,". ","__");
else
return replace(typeName,"$","__");
}

/**
* Convert an Exception name.
* <p>
Expand Down
5 changes: 5 additions & 0 deletions rmic/src/test/java/org/glassfish/rmic/RmicGenerationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;

/**
* Tests RMIC by comparing the kept generated source files against the expected files.
Expand All @@ -72,6 +73,7 @@ public class RmicGenerationTest {

private static int testNum = 0;
private static File rootDir;
private static final boolean COMPILE_GENERATED = true; // set false to check generated files without compiling

@SuppressWarnings("ResultOfMethodCallIgnored")
@BeforeClass
Expand Down Expand Up @@ -103,6 +105,7 @@ public void generateIiopStubsWithoutPoa() throws Exception {

@Test
public void whenKeepNotSpecified_deleteGeneratedJavaFiles() throws Exception {
assumeTrue(COMPILE_GENERATED);
GenerationControl generator = new GenerationControl(RmiIIServant.class);
generator.addArgs("-iiop");

Expand All @@ -113,6 +116,7 @@ public void whenKeepNotSpecified_deleteGeneratedJavaFiles() throws Exception {

@Test
public void afterProcessing_classFilesArePresent() throws Exception {
assumeTrue(COMPILE_GENERATED);
GenerationControl generator = new GenerationControl(RmiIIServant.class);
generator.addArgs("-iiop");

Expand Down Expand Up @@ -353,6 +357,7 @@ String getWarning() {
}

private void generate() throws IOException {
if (argList.contains("-iiop") && !COMPILE_GENERATED) addArgs("-Xnocompile");
for (String name : classNames)
addArgs(name);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Expand Down

0 comments on commit b922369

Please sign in to comment.