Skip to content

Commit

Permalink
[java decompiler] modifiers on JPMS requires statements
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 115e1b0498867d0cfaf95c119531019029e19935
  • Loading branch information
trespasserw authored and intellij-monorepo-bot committed Apr 3, 2024
1 parent 3b9887a commit 5489918
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/org/jetbrains/java/decompiler/code/CodeConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,15 @@ public interface CodeConstants {
int ACC_FINAL = 0x0010;
int ACC_SYNCHRONIZED = 0x0020;
int ACC_OPEN = 0x0020;
int ACC_NATIVE = 0x0100;
int ACC_ABSTRACT = 0x0400;
int ACC_STRICT = 0x0800;
int ACC_TRANSITIVE = 0x0020;
int ACC_VOLATILE = 0x0040;
int ACC_BRIDGE = 0x0040;
int ACC_STATIC_PHASE = 0x0040;
int ACC_TRANSIENT = 0x0080;
int ACC_VARARGS = 0x0080;
int ACC_NATIVE = 0x0100;
int ACC_ABSTRACT = 0x0400;
int ACC_STRICT = 0x0800;
int ACC_SYNTHETIC = 0x1000;
int ACC_ANNOTATION = 0x2000;
int ACC_ENUM = 0x4000;
Expand Down
9 changes: 6 additions & 3 deletions src/org/jetbrains/java/decompiler/main/ClassWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,10 @@ private static void writeModuleInfoBody(TextBuffer buffer, StructModuleAttribute
if (!requiresEntries.isEmpty()) {
for (StructModuleAttribute.RequiresEntry requires : requiresEntries) {
if (!isGenerated(requires.flags)) {
buffer.appendIndent(1).append("requires ").append(requires.moduleName.replace('/', '.')).append(';').appendLineSeparator();
buffer.appendIndent(1).append("requires ");
if ((requires.flags & CodeConstants.ACC_STATIC_PHASE) != 0) buffer.append("static ");
if ((requires.flags & CodeConstants.ACC_TRANSITIVE) != 0) buffer.append("transitive ");
buffer.append(requires.moduleName.replace('/', '.')).append(';').appendLineSeparator();
newLineNeeded = true;
}
}
Expand All @@ -563,7 +566,7 @@ private static void writeModuleInfoBody(TextBuffer buffer, StructModuleAttribute
if (!isGenerated(exports.flags)) {
buffer.appendIndent(1).append("exports ").append(exports.packageName.replace('/', '.'));
List<String> exportToModules = exports.exportToModules;
if (exportToModules.size() > 0) {
if (!exportToModules.isEmpty()) {
buffer.append(" to").appendLineSeparator();
appendFQClassNames(buffer, exportToModules);
}
Expand All @@ -580,7 +583,7 @@ private static void writeModuleInfoBody(TextBuffer buffer, StructModuleAttribute
if (!isGenerated(opens.flags)) {
buffer.appendIndent(1).append("opens ").append(opens.packageName.replace('/', '.'));
List<String> opensToModules = opens.opensToModules;
if (opensToModules.size() > 0) {
if (!opensToModules.isEmpty()) {
buffer.append(" to").appendLineSeparator();
appendFQClassNames(buffer, opensToModules);
}
Expand Down

0 comments on commit 5489918

Please sign in to comment.