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

Commit

Permalink
Merge "dx: Support v53 class files built from language level 8 sources."
Browse files Browse the repository at this point in the history
  • Loading branch information
15characterlimi authored and Gerrit Code Review committed Aug 11, 2017
2 parents 85c3817 + ea1fbbc commit b0786a9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
10 changes: 6 additions & 4 deletions dx/src/com/android/dx/cf/direct/DirectClassFile.java
Expand Up @@ -52,9 +52,11 @@ public class DirectClassFile implements ClassFile {
* See http://en.wikipedia.org/wiki/Java_class_file for an up-to-date
* list of version numbers. Currently known (taken from that table) are:
*
* J2SE 7.0 = 51 (0x33 hex),
* J2SE 6.0 = 50 (0x32 hex),
* J2SE 5.0 = 49 (0x31 hex),
* Java SE 9 = 53 (0x35 hex),
* Java SE 8 = 52 (0x34 hex),
* Java SE 7 = 51 (0x33 hex),
* Java SE 6.0 = 50 (0x32 hex),
* Java SE 5.0 = 49 (0x31 hex),
* JDK 1.4 = 48 (0x30 hex),
* JDK 1.3 = 47 (0x2F hex),
* JDK 1.2 = 46 (0x2E hex),
Expand All @@ -71,7 +73,7 @@ public class DirectClassFile implements ClassFile {
*
* Note: if you change this, please change "java.class.version" in System.java.
*/
private static final int CLASS_FILE_MAX_MAJOR_VERSION = 52;
private static final int CLASS_FILE_MAX_MAJOR_VERSION = 53;

/** maximum {@code .class} file minor version */
private static final int CLASS_FILE_MAX_MINOR_VERSION = 0;
Expand Down
22 changes: 20 additions & 2 deletions dx/src/com/android/dx/command/dexer/Main.java
Expand Up @@ -567,13 +567,15 @@ private boolean processAllFiles() {
}

// remaining files
FileNameFilter filter = new RemoveModuleInfoFilter(new NotFilter(mainPassFilter));
for (int i = 0; i < fileNames.length; i++) {
processOne(fileNames[i], new NotFilter(mainPassFilter));
processOne(fileNames[i], filter);
}
} else {
// without --main-dex-list
FileNameFilter filter = new RemoveModuleInfoFilter(ClassPathOpener.acceptAll);
for (int i = 0; i < fileNames.length; i++) {
processOne(fileNames[i], ClassPathOpener.acceptAll);
processOne(fileNames[i], filter);
}
}
} catch (StopProcessing ex) {
Expand Down Expand Up @@ -1159,6 +1161,22 @@ public boolean accept(String path) {
}
}

/**
* Filters "module-info.class" out of the paths accepted by delegate.
*/
private static class RemoveModuleInfoFilter implements FileNameFilter {
protected final FileNameFilter delegate;

public RemoveModuleInfoFilter(FileNameFilter delegate) {
this.delegate = delegate;
}

@Override
public boolean accept(String path) {
return delegate.accept(path) && !("module-info.class".equals(path));
}
}

/**
* A quick and accurate filter for when file path can be trusted.
*/
Expand Down

0 comments on commit b0786a9

Please sign in to comment.