Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support ClassFile loading from jar files.
Change on 2017/07/24 by tball <tball@google.com> ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=162999485
- Loading branch information
Showing
4 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
translator/src/test/java/com/google/devtools/j2objc/util/ClassFileTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,37 @@ | |||
/* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
*/ | |||
|
|||
package com.google.devtools.j2objc.util; | |||
|
|||
import com.google.devtools.j2objc.GenerationTest; | |||
import com.google.devtools.j2objc.file.InputFile; | |||
import com.google.devtools.j2objc.file.JarredInputFile; | |||
import java.io.IOException; | |||
|
|||
/** | |||
* Tests for {@link ClassFile}. | |||
* | |||
* Note: classfile conversion is experimental and not supported. | |||
*/ | |||
public class ClassFileTest extends GenerationTest { | |||
|
|||
public void testJarFileLoading() throws IOException { | |||
String jarFilePath = getResourceAsFile("packageInfoLookupTest.jar"); | |||
InputFile input = new JarredInputFile(jarFilePath, | |||
"com/google/test/packageInfoLookupTest/package-info.class"); | |||
ClassFile cf = ClassFile.create(input, null); | |||
assertNotNull(cf); | |||
assertEquals("com.google.test.packageInfoLookupTest.package-info", cf.getFullName()); | |||
} | |||
} |