diff options
-rw-r--r-- | test/121-modifiers/build | 40 | ||||
-rw-r--r-- | test/121-modifiers/info.txt | 17 | ||||
-rw-r--r-- | test/121-modifiers/smali/A$B.smali | 42 | ||||
-rw-r--r-- | test/121-modifiers/smali/A$C.smali | 30 | ||||
-rw-r--r-- | test/121-modifiers/smali/A.smali | 41 | ||||
-rw-r--r-- | test/121-modifiers/smali/Inf.smali | 23 | ||||
-rw-r--r-- | test/121-modifiers/smali/NonInf.smali | 177 | ||||
-rw-r--r-- | test/121-modifiers/src-java/A.java | 23 | ||||
-rw-r--r-- | test/121-modifiers/src-java/Asm.java (renamed from test/121-modifiers/src/Asm.java) | 0 | ||||
-rw-r--r-- | test/121-modifiers/src-java/Inf.java (renamed from test/121-modifiers/src/Inf.java) | 0 | ||||
-rw-r--r-- | test/121-modifiers/src-java/NonInf.java (renamed from test/121-modifiers/src/NonInf.java) | 0 | ||||
-rw-r--r-- | test/121-modifiers/src2/Main.java (renamed from test/121-modifiers/src/Main.java) | 8 | ||||
-rwxr-xr-x | test/etc/default-build | 4 |
13 files changed, 355 insertions, 50 deletions
diff --git a/test/121-modifiers/build b/test/121-modifiers/build deleted file mode 100644 index 771dd51829..0000000000 --- a/test/121-modifiers/build +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2014 The Android Open Source Project -# -# 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. - -# Stop if something fails. -set -e - -# The classes are pre-compiled and modified with ASM. -# -# To reproduce, compile the source files. Asm.java needs the ASM libraries (core and tree). Then -# run Asm.java, which produces Inf.out and NonInf.out. Rename these to class files and put them -# into the classes directory (this assumes the ASM libraries are names asm.jar and asm-tree.jar): -# -# javac Inf.java NonInf.java Main.java -# javac -cp asm.jar:asm-tree.jar:. Asm.java -# java -cp asm.jar:asm-tree.jar:. Asm -# mv Inf.out classes/Inf.class -# mv NonInf.out classes/NonInf.class -# mv Main.class A.class A\$B.class A\$C.class classes/ - -if [ ${USE_JACK} = "true" ]; then - jar cf classes.jill.jar -C classes . - # Workaround b/19561685: disable sanity checks to produce a DEX file with invalid modifiers. - ${JACK} --sanity-checks off --import classes.jill.jar --output-dex . -else - ${DX} --debug --dex --dump-to=classes.lst --output=classes.dex classes -fi -zip $TEST_NAME.jar classes.dex diff --git a/test/121-modifiers/info.txt b/test/121-modifiers/info.txt index 943cbf8aba..129aee8ae6 100644 --- a/test/121-modifiers/info.txt +++ b/test/121-modifiers/info.txt @@ -1 +1,18 @@ This is a test checking the modifier (access flags) handling of ART. + +The classes are pre-compiled and modified with ASM. + +To reproduce, compile the source files. Asm.java needs the ASM libraries (core and tree). Then +run Asm.java, which produces Inf.out and NonInf.out. Rename these to class files and put them +into the classes directory (this assumes the ASM libraries are names asm.jar and asm-tree.jar). +Finally, compile with jack/jill or dx, and run baksmali. + +javac Inf.java NonInf.java Main.java +javac -cp asm.jar:asm-tree.jar:. Asm.java +java -cp asm.jar:asm-tree.jar:. Asm +mv Inf.out classes/Inf.class +mv NonInf.out classes/NonInf.class +mv Main.class A.class A\$B.class A\$C.class classes/ +dx --debug --dex --output=classes.dex classes +baksmali classes.dex +mv out/*.smali smali/ diff --git a/test/121-modifiers/smali/A$B.smali b/test/121-modifiers/smali/A$B.smali new file mode 100644 index 0000000000..d6addc2c94 --- /dev/null +++ b/test/121-modifiers/smali/A$B.smali @@ -0,0 +1,42 @@ +# +# Copyright (C) 2014 The Android Open Source Project +# +# 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. +# + +.class LA$B; +.super Ljava/lang/Object; +.source "Main.java" + + +# annotations +.annotation system Ldalvik/annotation/EnclosingClass; + value = LA; +.end annotation + +.annotation system Ldalvik/annotation/InnerClass; + accessFlags = 0xa + name = "B" +.end annotation + + +# direct methods +.method private constructor <init>()V + .registers 1 + + .prologue + .line 19 + invoke-direct {p0}, Ljava/lang/Object;-><init>()V + + return-void +.end method diff --git a/test/121-modifiers/smali/A$C.smali b/test/121-modifiers/smali/A$C.smali new file mode 100644 index 0000000000..eba4756ad6 --- /dev/null +++ b/test/121-modifiers/smali/A$C.smali @@ -0,0 +1,30 @@ +# +# Copyright (C) 2014 The Android Open Source Project +# +# 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. +# + +.class public interface abstract LA$C; +.super Ljava/lang/Object; +.source "Main.java" + + +# annotations +.annotation system Ldalvik/annotation/EnclosingClass; + value = LA; +.end annotation + +.annotation system Ldalvik/annotation/InnerClass; + accessFlags = 0x60c + name = "C" +.end annotation diff --git a/test/121-modifiers/smali/A.smali b/test/121-modifiers/smali/A.smali new file mode 100644 index 0000000000..b1078bcce0 --- /dev/null +++ b/test/121-modifiers/smali/A.smali @@ -0,0 +1,41 @@ +# +# Copyright (C) 2014 The Android Open Source Project +# +# 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. +# + +.class LA; +.super Ljava/lang/Object; +.source "Main.java" + + +# annotations +.annotation system Ldalvik/annotation/MemberClasses; + value = { + LA$B;, + LA$C; + } +.end annotation + + +# direct methods +.method constructor <init>()V + .registers 1 + + .prologue + .line 18 + invoke-direct {p0}, Ljava/lang/Object;-><init>()V + + .line 21 + return-void +.end method diff --git a/test/121-modifiers/smali/Inf.smali b/test/121-modifiers/smali/Inf.smali new file mode 100644 index 0000000000..6a3a7ab24c --- /dev/null +++ b/test/121-modifiers/smali/Inf.smali @@ -0,0 +1,23 @@ +# +# Copyright (C) 2014 The Android Open Source Project +# +# 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. +# + +.class public interface abstract LInf; +.super Ljava/lang/Object; +.source "Inf.java" + + +# static fields +.field public static final I:I diff --git a/test/121-modifiers/smali/NonInf.smali b/test/121-modifiers/smali/NonInf.smali new file mode 100644 index 0000000000..34bf0312e4 --- /dev/null +++ b/test/121-modifiers/smali/NonInf.smali @@ -0,0 +1,177 @@ +# +# Copyright (C) 2014 The Android Open Source Project +# +# 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. +# + +.class public abstract LNonInf; +.super Ljava/lang/Object; +.source "NonInf.java" + + +# static fields +.field static staticField:I + + +# instance fields +.field final finalField:I + +.field private privateField:I + +.field protected protectedField:I + +.field public publicField:I + +.field transient transientField:I + +.field volatile volatileField:I + + +# direct methods +.method public constructor <init>()V + .registers 2 + + .prologue + .line 11 + invoke-direct {p0}, Ljava/lang/Object;-><init>()V + + .line 12 + const/4 v0, 0x0 + + iput v0, p0, LNonInf;->publicField:I + + .line 13 + const/4 v0, 0x1 + + iput v0, p0, LNonInf;->privateField:I + + .line 14 + const/4 v0, 0x2 + + iput v0, p0, LNonInf;->protectedField:I + + .line 15 + const/4 v0, 0x3 + + sput v0, LNonInf;->staticField:I + + .line 16 + const/4 v0, 0x4 + + iput v0, p0, LNonInf;->transientField:I + + .line 17 + const/4 v0, 0x5 + + iput v0, p0, LNonInf;->volatileField:I + + .line 18 + const/4 v0, 0x6 + + iput v0, p0, LNonInf;->finalField:I + + .line 19 + return-void +.end method + +.method private privateMethod()I + .registers 2 + + .prologue + .line 24 + const/4 v0, 0x0 + + return v0 +.end method + +.method public static staticMethod()I + .registers 1 + + .prologue + .line 42 + const/4 v0, 0x0 + + return v0 +.end method + + +# virtual methods +.method public abstract abstractMethod()I +.end method + +.method public final finalMethod()I + .registers 2 + + .prologue + .line 54 + const/4 v0, 0x0 + + return v0 +.end method + +.method public native nativeMethod()V +.end method + +.method protected protectedMethod()I + .registers 2 + + .prologue + .line 28 + const/4 v0, 0x0 + + return v0 +.end method + +.method public publicMethod()I + .registers 2 + + .prologue + .line 32 + const/4 v0, 0x0 + + return v0 +.end method + +.method public strictfp strictfpMethod()D + .registers 3 + + .prologue + .line 46 + const-wide/16 v0, 0x0 + + return-wide v0 +.end method + +.method public declared-synchronized synchronizedMethod()I + .registers 2 + + .prologue + monitor-enter p0 + + .line 38 + const/4 v0, 0x0 + + monitor-exit p0 + + return v0 +.end method + +.method public varargs varargsMethod([Ljava/lang/Object;)I + .registers 3 + + .prologue + .line 50 + const/4 v0, 0x0 + + return v0 +.end method diff --git a/test/121-modifiers/src-java/A.java b/test/121-modifiers/src-java/A.java new file mode 100644 index 0000000000..d97f6b3f89 --- /dev/null +++ b/test/121-modifiers/src-java/A.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * 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. + */ + +// These classes are to check the additional flags for inner classes. +class A { + private static class B { + } + protected static interface C { + } +} diff --git a/test/121-modifiers/src/Asm.java b/test/121-modifiers/src-java/Asm.java index f120622120..f120622120 100644 --- a/test/121-modifiers/src/Asm.java +++ b/test/121-modifiers/src-java/Asm.java diff --git a/test/121-modifiers/src/Inf.java b/test/121-modifiers/src-java/Inf.java index 1dadae0e47..1dadae0e47 100644 --- a/test/121-modifiers/src/Inf.java +++ b/test/121-modifiers/src-java/Inf.java diff --git a/test/121-modifiers/src/NonInf.java b/test/121-modifiers/src-java/NonInf.java index 52e4882532..52e4882532 100644 --- a/test/121-modifiers/src/NonInf.java +++ b/test/121-modifiers/src-java/NonInf.java diff --git a/test/121-modifiers/src/Main.java b/test/121-modifiers/src2/Main.java index e21b789cc7..62e65a8fbe 100644 --- a/test/121-modifiers/src/Main.java +++ b/test/121-modifiers/src2/Main.java @@ -14,14 +14,6 @@ * limitations under the License. */ -// These classes are to check the additional flags for inner classes. -class A { - private static class B { - } - protected static interface C { - } -} - public class Main { public final static int INTERFACE_DEFINED_BITS = 0x0001 | // public, may be set. diff --git a/test/etc/default-build b/test/etc/default-build index e9e388646a..e13f724b94 100755 --- a/test/etc/default-build +++ b/test/etc/default-build @@ -234,7 +234,7 @@ else fi fi -if [ "${HAS_SMALI}" = "true" ]; then +if [ "${HAS_SMALI}" = "true" -a ${NEED_DEX} = "true" ]; then # Compile Smali classes ${SMALI} -JXmx512m ${SMALI_ARGS} --output smali_classes.dex `find smali -name '*.smali'` @@ -246,7 +246,7 @@ if [ "${HAS_SMALI}" = "true" ]; then fi fi -if [ "${HAS_SMALI_MULTIDEX}" = "true" ]; then +if [ "${HAS_SMALI_MULTIDEX}" = "true" -a ${NEED_DEX} = "true" ]; then # Compile Smali classes ${SMALI} -JXmx512m ${SMALI_ARGS} --output smali_classes2.dex `find smali-multidex -name '*.smali'` |