From 3854b67daac14188d47a86bb6b84ccb00c087f5f Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Mon, 1 Sep 2014 15:05:08 +0400 Subject: [PATCH] java-decompiler: post-import cleanup (tests reorganized) --- build.xml | 24 +++- .../main/decompiler/ConsoleDecompiler.java | 7 +- .../java/decompiler/SingleClassesTest.java | 124 ++++++++++++++++++ test/unit/TestSingleClasses.java | 95 -------------- test/unit/classes/TestClassFields.java | 13 -- test/unit/classes/TestClassSwitch.java | 16 --- testData/classes/pkg/TestClassFields.class | Bin 0 -> 415 bytes testData/classes/pkg/TestClassLambda.class | Bin 0 -> 3714 bytes testData/classes/pkg/TestClassLoop.class | Bin 0 -> 880 bytes testData/classes/pkg/TestClassSwitch.class | Bin 0 -> 464 bytes testData/classes/pkg/TestClassTypes.class | Bin 0 -> 1151 bytes testData/classes/pkg/TestClassVar.class | Bin 0 -> 992 bytes .../results/TestClassFields.dec | 3 +- .../results/TestClassLambda.dec | 2 +- .../results/TestClassLoop.dec | 2 +- .../results/TestClassSwitch.dec | 2 +- .../results/TestClassTypes.dec | 2 +- .../results/TestClassVar.dec | 2 +- testData/src/pkg/TestClassFields.java | 28 ++++ .../src/pkg}/TestClassLambda.java | 17 ++- .../src/pkg}/TestClassLoop.java | 17 ++- testData/src/pkg/TestClassSwitch.java | 31 +++++ .../src/pkg}/TestClassTypes.java | 17 ++- .../src/pkg}/TestClassVar.java | 17 ++- 24 files changed, 282 insertions(+), 137 deletions(-) create mode 100644 test/org/jetbrains/java/decompiler/SingleClassesTest.java delete mode 100644 test/unit/TestSingleClasses.java delete mode 100644 test/unit/classes/TestClassFields.java delete mode 100644 test/unit/classes/TestClassSwitch.java create mode 100644 testData/classes/pkg/TestClassFields.class create mode 100644 testData/classes/pkg/TestClassLambda.class create mode 100644 testData/classes/pkg/TestClassLoop.class create mode 100644 testData/classes/pkg/TestClassSwitch.class create mode 100644 testData/classes/pkg/TestClassTypes.class create mode 100644 testData/classes/pkg/TestClassVar.class rename {test/unit => testData}/results/TestClassFields.dec (89%) rename {test/unit => testData}/results/TestClassLambda.dec (98%) rename {test/unit => testData}/results/TestClassLoop.dec (97%) rename {test/unit => testData}/results/TestClassSwitch.dec (91%) rename {test/unit => testData}/results/TestClassTypes.dec (97%) rename {test/unit => testData}/results/TestClassVar.dec (97%) create mode 100644 testData/src/pkg/TestClassFields.java rename {test/unit/classes => testData/src/pkg}/TestClassLambda.java (69%) rename {test/unit/classes => testData/src/pkg}/TestClassLoop.java (50%) create mode 100644 testData/src/pkg/TestClassSwitch.java rename {test/unit/classes => testData/src/pkg}/TestClassTypes.java (57%) rename {test/unit/classes => testData/src/pkg}/TestClassVar.java (51%) diff --git a/build.xml b/build.xml index 1c1a5f0..24d18f0 100644 --- a/build.xml +++ b/build.xml @@ -3,13 +3,19 @@ - + + + + + + + @@ -27,4 +33,20 @@ + + + + + + + + + + + + + + + + diff --git a/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java b/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java index 50a55cf..28bb4ee 100644 --- a/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java +++ b/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java @@ -133,7 +133,12 @@ public class ConsoleDecompiler implements IBytecodeProvider, IDecompilatSaver { public void decompileContext(File root) { this.root = root; - fernflower.decompileContext(); + try { + fernflower.decompileContext(); + } + finally { + fernflower.clearContext(); + } } // ******************************************************************* diff --git a/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/test/org/jetbrains/java/decompiler/SingleClassesTest.java new file mode 100644 index 0000000..1e37d97 --- /dev/null +++ b/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -0,0 +1,124 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * 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 org.jetbrains.java.decompiler; + +import org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler; +import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.io.*; +import java.util.HashMap; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class SingleClassesTest { + private File tempDir; + private ConsoleDecompiler decompiler; + + @Before + public void setUp() throws IOException { + tempDir = File.createTempFile("decompiler_test_", "_dir"); + assertTrue(tempDir.delete()); + assertTrue(tempDir.mkdirs()); + decompiler = new ConsoleDecompiler(new HashMap() {{ + boolean win = System.getProperty("os.name", "").startsWith("Windows"); + put(IFernflowerPreferences.LOG_LEVEL, "warn"); + put(IFernflowerPreferences.RENAME_ENTITIES, "1"); + put(IFernflowerPreferences.HIDE_DEFAULT_CONSTRUCTOR, "1"); + put(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES, "0"); + put(IFernflowerPreferences.IDEA_NOT_NULL_ANNOTATION, "1"); + put(IFernflowerPreferences.LAMBDA_TO_ANONYMOUS_CLASS, "0"); + put(IFernflowerPreferences.USE_DEBUG_VARNAMES, "0"); + put(IFernflowerPreferences.NEW_LINE_SEPARATOR, (win ? "0" : "1")); + }}); + } + + @After + public void tearDown() { + decompiler = null; + delete(tempDir); + tempDir = null; + } + + @Test public void testClassFields() { doTest("TestClassFields"); } + @Test public void testClassLambda() { doTest("TestClassLambda"); } + @Test public void testClassLoop() { doTest("TestClassLoop"); } + @Test public void testClassSwitch() { doTest("TestClassSwitch"); } + @Test public void testClassTypes() { doTest("TestClassTypes"); } + @Test public void testClassVar() { doTest("TestClassVar"); } + + private void doTest(String testName) { + try { + File testDataDir = new File("testData"); + if (!isTestDataDir(testDataDir)) testDataDir = new File("community/plugins/java-decompiler/engine/testData"); + if (!isTestDataDir(testDataDir)) testDataDir = new File("plugins/java-decompiler/engine/testData"); + assertTrue(isTestDataDir(testDataDir)); + + File classFile = new File(testDataDir, "/classes/pkg/" + testName + ".class"); + assertTrue(classFile.isFile()); + decompiler.addSpace(classFile, true); + decompiler.decompileContext(tempDir); + + File decompiledFile = new File(tempDir, testName + ".java"); + assertTrue(decompiledFile.isFile()); + + File referenceFile = new File(testDataDir, "results/" + testName + ".dec"); + assertTrue(referenceFile.isFile()); + + String decompiledContent = getContent(decompiledFile); + String referenceContent = getContent(referenceFile); + assertEquals(referenceContent, decompiledContent); + } + catch (Exception e) { + throw new RuntimeException(e); + } + } + + private static boolean isTestDataDir(File dir) { + return dir.isDirectory() && new File(dir, "classes").isDirectory() && new File(dir, "results").isDirectory(); + } + + private static String getContent(File file) throws IOException { + Reader reader = new InputStreamReader(new FileInputStream(file), "UTF-8"); + try { + char[] buff = new char[16 * 1024]; + StringBuilder content = new StringBuilder(); + int n; + while ((n = reader.read(buff)) > 0) { + content.append(buff, 0, n); + } + return content.toString(); + } + finally { + reader.close(); + } + } + + private static void delete(File file) { + if (file.isDirectory()) { + File[] files = file.listFiles(); + if (files != null) { + for (File f : files) delete(f); + } + } + else { + assertTrue(file.delete()); + } + } +} diff --git a/test/unit/TestSingleClasses.java b/test/unit/TestSingleClasses.java deleted file mode 100644 index 754fcec..0000000 --- a/test/unit/TestSingleClasses.java +++ /dev/null @@ -1,95 +0,0 @@ -package unit; - -import static org.junit.Assert.*; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.util.Date; -import java.util.HashMap; - -import org.junit.Test; - -import de.fernflower.main.decompiler.ConsoleDecompiler; -import de.fernflower.main.extern.IFernflowerPreferences; - -public class TestSingleClasses { - - @Test - public void test() throws IOException { - - Date start = new Date(); - - String current_path = new File(".").getCanonicalPath().toString(); - - iterateDirectory(new File(current_path + "/bin/unit/classes/")); - - System.out.println("\n\nTime elapsed " + (new Date().getTime() - start.getTime())/1000); - } - - private void iterateDirectory(File dir) throws IOException { - - for (File file : dir.listFiles()) { - if (file.isDirectory()) { - iterateDirectory(file); - } else if(file.getName().endsWith(".class")) { - decompileAndCheckFile(file); - } - } - } - - private void decompileAndCheckFile(File file) throws IOException { - - try { - - ConsoleDecompiler decompiler = new ConsoleDecompiler(new HashMap(){{ - put("log", "warn"); - put("ren", "1"); - put(IFernflowerPreferences.HIDE_DEFAULT_CONSTRUCTOR, "1"); - put(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES, "0"); - put(IFernflowerPreferences.IDEA_NOT_NULL_ANNOTATION, "1"); - put(IFernflowerPreferences.LAMBDA_TO_ANONYMOUS_CLASS, "0"); - put(IFernflowerPreferences.USE_DEBUG_VARNAMES, "0"); - put(IFernflowerPreferences.NEW_LINE_SEPARATOR, "0"); - }}); - - decompiler.addSpace(file, true); - - // files - String current_path = new File(".").getCanonicalPath().toString(); - - String file_class_name = file.getName(); - String file_name = file_class_name.substring(0, file_class_name.lastIndexOf(".class")); - String file_java_name = file_name+".java"; - - File reference_file = new File(current_path + "/test/unit/results/" + file_name + ".dec"); - if(!reference_file.exists()) { - return; // no reference file for some reason, not yet created - } - - File temp_dir = new File(Files.createTempDirectory("tempdec_"+file_name).toString()); - - // decompile it - decompiler.decompileContext(temp_dir); - - // get both the decompiled file content and the reference - // NOTE: reference files are saved with Windows-style line endings. Convert them if you are decompiling to Unix. - File decompiled_file = new File(temp_dir, file_java_name); - String decompiled_content = new String(Files.readAllBytes(decompiled_file.toPath()), "UTF-8"); - String reference_content = new String(Files.readAllBytes(reference_file.toPath()), "UTF-8"); - - // clean up - decompiled_file.delete(); - temp_dir.delete(); - - // compare file content with the reference - assertEquals(decompiled_content, reference_content); - - } catch(Exception ex) { - System.out.println("ERROR: testing file " + file.getCanonicalPath()); - ex.printStackTrace(); - } - - } - -} diff --git a/test/unit/classes/TestClassFields.java b/test/unit/classes/TestClassFields.java deleted file mode 100644 index 8ae7449..0000000 --- a/test/unit/classes/TestClassFields.java +++ /dev/null @@ -1,13 +0,0 @@ -package unit.classes; - -public class TestClassFields { - - private static int[] sizes; - private static String[] names; - - static { - - names = new String[]{"name1", "name2"}; - sizes = new int[names.length]; - } -} diff --git a/test/unit/classes/TestClassSwitch.java b/test/unit/classes/TestClassSwitch.java deleted file mode 100644 index 3e29d5e..0000000 --- a/test/unit/classes/TestClassSwitch.java +++ /dev/null @@ -1,16 +0,0 @@ -package unit.classes; - -public class TestClassSwitch { - - public void testCaseOrder(int a) { - - switch(a) { - case 13: - System.out.println(13); - return; - case 5: - System.out.println(5); - } - } - -} diff --git a/testData/classes/pkg/TestClassFields.class b/testData/classes/pkg/TestClassFields.class new file mode 100644 index 0000000000000000000000000000000000000000..c1c0c6b9717c0162f38f3c0e862b0d8daeb309a1 GIT binary patch literal 415 zcmZ8dO;5r=5PjQkmWm4a1$ywN9wZuX5HBPoCPWVNQ@)gV<|sjL{Ld_n6II-<-dn`dueFI12iMQcUsB(eS5+J-?dK-2t$ mHq@)SH#Dk-w}ANybNRs+u>J%p(5aQvco_}yWvCL?Q2PNs+)Kv* literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestClassLambda.class b/testData/classes/pkg/TestClassLambda.class new file mode 100644 index 0000000000000000000000000000000000000000..cbb9448a2068b4d1f061c6f57efcbaa1de717bfa GIT binary patch literal 3714 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 a!<^uNr${y(&_p4A;IK{+0>_yZ!oVNaSkLnS literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestClassVar.class b/testData/classes/pkg/TestClassVar.class new file mode 100644 index 0000000000000000000000000000000000000000..d66170c042144a283e3693c57ae2515388887a42 GIT binary patch literal 992 zcmY*XO-~b16g_V`Fm#-L@KuFEK|b4xR1{aDiNTm?KuL-uV4_Z8ECbV-W;*z>*QINt z3r*Z~D+a}AqI-A#0Dpx$Lab+Is?faTzIV^uIrpCP-j6?Dz5$rU1r;g=R16{$MHEAR z7>?pJMpTSqOu@Jc1rrJ;6=Vfs4^6|`xLu zRs`gEXTuOkESR=&Yo}5&+-1FF5s4K&eSLdTuLe0g5b}(gcinGMEMC2%ASV!Sfo24{ zvblvV{gGafR=Ob9H;esRX`VYauE=t$Bw3!Py~QZz$h%3QI0cFM6(_ zSLi|5rWF=Ys(z70E9C6W+zM|t${PnHF3RPJwj<76=80}Fb~3w%HlBcVejg(L8B+Y^ z8z^!ea^xc-c?NlxpCxoL#t~tZx!Tdo_tMR55K@CoLP1Xu8pMJ`BEpx#!hgM9kj5vt z7@12a)psa-K-(v@=l2kKg@G`sqkAy~q9HK#{h1K;#?M_+b#Q_V3BqYcn1kYcG|ncy z93#Vhg8MY_S)_sqQ)oMcBXnpx1r}Nl-2y|9^^Io0kuEh zN5^~Oe2#>E|z|cXfXQkf%IE6)zllmj_eEtWJoYf5hJ{> hG4yl%AxvT%Ib@L!1SCQMhfqY~0IJ0P{hUTZ`Y+4Ix|9F_ literal 0 HcmV?d00001 diff --git a/test/unit/results/TestClassFields.dec b/testData/results/TestClassFields.dec similarity index 89% rename from test/unit/results/TestClassFields.dec rename to testData/results/TestClassFields.dec index 85aea77..2a20fb8 100644 --- a/test/unit/results/TestClassFields.dec +++ b/testData/results/TestClassFields.dec @@ -1,4 +1,4 @@ -package unit.classes; +package pkg; public class TestClassFields { @@ -10,5 +10,4 @@ public class TestClassFields { static { sizes = new int[names.length]; } - } diff --git a/test/unit/results/TestClassLambda.dec b/testData/results/TestClassLambda.dec similarity index 98% rename from test/unit/results/TestClassLambda.dec rename to testData/results/TestClassLambda.dec index 6ff82d8..baf2cd7 100644 --- a/test/unit/results/TestClassLambda.dec +++ b/testData/results/TestClassLambda.dec @@ -1,4 +1,4 @@ -package unit.classes; +package pkg; import java.util.ArrayList; import java.util.Arrays; diff --git a/test/unit/results/TestClassLoop.dec b/testData/results/TestClassLoop.dec similarity index 97% rename from test/unit/results/TestClassLoop.dec rename to testData/results/TestClassLoop.dec index a931148..b231ae0 100644 --- a/test/unit/results/TestClassLoop.dec +++ b/testData/results/TestClassLoop.dec @@ -1,4 +1,4 @@ -package unit.classes; +package pkg; public class TestClassLoop { diff --git a/test/unit/results/TestClassSwitch.dec b/testData/results/TestClassSwitch.dec similarity index 91% rename from test/unit/results/TestClassSwitch.dec rename to testData/results/TestClassSwitch.dec index 386a341..496dd15 100644 --- a/test/unit/results/TestClassSwitch.dec +++ b/testData/results/TestClassSwitch.dec @@ -1,4 +1,4 @@ -package unit.classes; +package pkg; public class TestClassSwitch { diff --git a/test/unit/results/TestClassTypes.dec b/testData/results/TestClassTypes.dec similarity index 97% rename from test/unit/results/TestClassTypes.dec rename to testData/results/TestClassTypes.dec index 0bda616..2c856b1 100644 --- a/test/unit/results/TestClassTypes.dec +++ b/testData/results/TestClassTypes.dec @@ -1,4 +1,4 @@ -package unit.classes; +package pkg; import java.util.ArrayList; import java.util.List; diff --git a/test/unit/results/TestClassVar.dec b/testData/results/TestClassVar.dec similarity index 97% rename from test/unit/results/TestClassVar.dec rename to testData/results/TestClassVar.dec index cca4d7a..ceb3a4d 100644 --- a/test/unit/results/TestClassVar.dec +++ b/testData/results/TestClassVar.dec @@ -1,4 +1,4 @@ -package unit.classes; +package pkg; public class TestClassVar { diff --git a/testData/src/pkg/TestClassFields.java b/testData/src/pkg/TestClassFields.java new file mode 100644 index 0000000..347b687 --- /dev/null +++ b/testData/src/pkg/TestClassFields.java @@ -0,0 +1,28 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * 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 pkg; + +public class TestClassFields { + + private static int[] sizes; + private static String[] names; + + static { + + names = new String[]{"name1", "name2"}; + sizes = new int[names.length]; + } +} diff --git a/test/unit/classes/TestClassLambda.java b/testData/src/pkg/TestClassLambda.java similarity index 69% rename from test/unit/classes/TestClassLambda.java rename to testData/src/pkg/TestClassLambda.java index a2b9d9a..d3fc7f6 100644 --- a/test/unit/classes/TestClassLambda.java +++ b/testData/src/pkg/TestClassLambda.java @@ -1,4 +1,19 @@ -package unit.classes; +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * 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 pkg; import java.util.ArrayList; import java.util.Arrays; diff --git a/test/unit/classes/TestClassLoop.java b/testData/src/pkg/TestClassLoop.java similarity index 50% rename from test/unit/classes/TestClassLoop.java rename to testData/src/pkg/TestClassLoop.java index 5288cf6..25964d9 100644 --- a/test/unit/classes/TestClassLoop.java +++ b/testData/src/pkg/TestClassLoop.java @@ -1,4 +1,19 @@ -package unit.classes; +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * 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 pkg; public class TestClassLoop { diff --git a/testData/src/pkg/TestClassSwitch.java b/testData/src/pkg/TestClassSwitch.java new file mode 100644 index 0000000..aa49bb1 --- /dev/null +++ b/testData/src/pkg/TestClassSwitch.java @@ -0,0 +1,31 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * 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 pkg; + +public class TestClassSwitch { + + public void testCaseOrder(int a) { + + switch(a) { + case 13: + System.out.println(13); + return; + case 5: + System.out.println(5); + } + } + +} diff --git a/test/unit/classes/TestClassTypes.java b/testData/src/pkg/TestClassTypes.java similarity index 57% rename from test/unit/classes/TestClassTypes.java rename to testData/src/pkg/TestClassTypes.java index a8a5116..70e23c3 100644 --- a/test/unit/classes/TestClassTypes.java +++ b/testData/src/pkg/TestClassTypes.java @@ -1,4 +1,19 @@ -package unit.classes; +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * 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 pkg; import java.util.ArrayList; import java.util.List; diff --git a/test/unit/classes/TestClassVar.java b/testData/src/pkg/TestClassVar.java similarity index 51% rename from test/unit/classes/TestClassVar.java rename to testData/src/pkg/TestClassVar.java index fdba5c6..9f8fcac 100644 --- a/test/unit/classes/TestClassVar.java +++ b/testData/src/pkg/TestClassVar.java @@ -1,4 +1,19 @@ -package unit.classes; +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * 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 pkg; public class TestClassVar {