Move some default-methods tests to Java from Smali.
Move all smali tests for default method behavior in
non-source-incompatible contexts to java. Also move some of the
simpler tests for source and binary incompatibilities into java as
well when possible.
Bug: 27310767
Change-Id: I753196f19849494825953c1bf06f15b7132f459b
diff --git a/test/048-reflect-v8/build b/test/048-reflect-v8/build
index 4ea1838..3552b5c 100644
--- a/test/048-reflect-v8/build
+++ b/test/048-reflect-v8/build
@@ -20,9 +20,5 @@
# Hard-wired use of experimental jack.
# TODO: fix this temporary work-around for lambdas, see b/19467889
export USE_JACK=true
-export JACK_SERVER=false
-export JACK_REPOSITORY="${ANDROID_BUILD_TOP}/prebuilts/sdk/tools/jacks"
-# e.g. /foo/bar/jack-3.10.ALPHA.jar -> 3.10.ALPHA
-export JACK_VERSION="$(find "$JACK_REPOSITORY" -name '*ALPHA*' | sed 's/.*jack-//g' | sed 's/[.]jar//g')"
./default-build "$@" --experimental default-methods
diff --git a/test/563-checker-invoke-super/build b/test/563-checker-invoke-super/build
index e06193b..32f84ef 100755
--- a/test/563-checker-invoke-super/build
+++ b/test/563-checker-invoke-super/build
@@ -20,9 +20,5 @@
# Hard-wired use of experimental jack.
# TODO: fix this temporary work-around for lambdas, see b/19467889
export USE_JACK=true
-export JACK_SERVER=false
-export JACK_REPOSITORY="${ANDROID_BUILD_TOP}/prebuilts/sdk/tools/jacks"
-# e.g. /foo/bar/jack-3.10.ALPHA.jar -> 3.10.ALPHA
-export JACK_VERSION="$(find "$JACK_REPOSITORY" -name '*ALPHA*' | sed 's/.*jack-//g' | sed 's/[.]jar//g')"
./default-build "$@" --experimental default-methods
diff --git a/test/960-default-smali/build b/test/960-default-smali/build
index b72afcd..e8f4ed0 100755
--- a/test/960-default-smali/build
+++ b/test/960-default-smali/build
@@ -17,27 +17,14 @@
# make us exit on a failure
set -e
-# Generate the smali Main.smali file or fail
-${ANDROID_BUILD_TOP}/art/test/utils/python/generate_smali_main.py ./smali
-
-# Should we compile with Java source code. By default we will use Smali.
-USES_JAVA_SOURCE="false"
-if [[ $@ == *"--jvm"* ]]; then
- USES_JAVA_SOURCE="true"
-elif [[ "$USE_JACK" == "true" ]]; then
- if $JACK -D jack.java.source.version=1.8 >& /dev/null; then
- USES_JAVA_SOURCE="true"
- else
- echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2
- fi
+if [[ $@ != *"--jvm"* ]]; then
+ # Don't do anything with jvm
+ # Hard-wired use of experimental jack.
+ # TODO: fix this temporary work-around for default-methods, see b/19467889
+ export USE_JACK=true
fi
-if [[ "$USES_JAVA_SOURCE" == "true" ]]; then
- # We are compiling java code, create it.
- mkdir -p src
- ${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src
- # Ignore the smali directory.
- EXTRA_ARGS="--no-smali"
-fi
+# Generate the Main.java file or fail
+${ANDROID_BUILD_TOP}/art/test/utils/python/generate_java_main.py ./src
-./default-build "$@" "$EXTRA_ARGS" --experimental default-methods
+./default-build "$@" --experimental default-methods
diff --git a/test/960-default-smali/smali/A.smali b/test/960-default-smali/smali/A.smali
deleted file mode 100644
index e755612..0000000
--- a/test/960-default-smali/smali/A.smali
+++ /dev/null
@@ -1,38 +0,0 @@
-# /*
-# * Copyright 2015 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 LA;
-.super Ljava/lang/Object;
-.implements LGreeter;
-
-# class A implements Greeter {
-# public String SayHi() {
-# return "Hi ";
-# }
-# }
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
-.method public SayHi()Ljava/lang/String;
- .registers 1
-
- const-string v0, "Hi "
- return-object v0
-.end method
diff --git a/test/960-default-smali/smali/Attendant.smali b/test/960-default-smali/smali/Attendant.smali
deleted file mode 100644
index ab63aee..0000000
--- a/test/960-default-smali/smali/Attendant.smali
+++ /dev/null
@@ -1,53 +0,0 @@
-# /*
-# * Copyright 2015 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 interface LAttendant;
-.super Ljava/lang/Object;
-
-# public interface Attendant {
-# public default String SayHi() {
-# return "welcome to " + GetPlace();
-# }
-# public default String SayHiTwice() {
-# return SayHi() + SayHi();
-# }
-#
-# public String GetPlace();
-# }
-
-.method public SayHi()Ljava/lang/String;
- .locals 2
- const-string v0, "welcome to "
- invoke-interface {p0}, LAttendant;->GetPlace()Ljava/lang/String;
- move-result-object v1
- invoke-virtual {v0, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- return-object v0
-.end method
-
-.method public SayHiTwice()Ljava/lang/String;
- .locals 2
- invoke-interface {p0}, LAttendant;->SayHi()Ljava/lang/String;
- move-result-object v0
- invoke-interface {p0}, LAttendant;->SayHi()Ljava/lang/String;
- move-result-object v1
- invoke-virtual {v0, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- return-object v0
-.end method
-
-.method public abstract GetPlace()Ljava/lang/String;
-.end method
diff --git a/test/960-default-smali/smali/B.smali b/test/960-default-smali/smali/B.smali
deleted file mode 100644
index d847dd1..0000000
--- a/test/960-default-smali/smali/B.smali
+++ /dev/null
@@ -1,38 +0,0 @@
-# /*
-# * Copyright 2015 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 LB;
-.super Ljava/lang/Object;
-.implements LGreeter2;
-
-# class B implements Greeter2 {
-# public String SayHi() {
-# return "Hello ";
-# }
-# }
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
-.method public SayHi()Ljava/lang/String;
- .registers 1
-
- const-string v0, "Hello "
- return-object v0
-.end method
diff --git a/test/960-default-smali/smali/C.smali b/test/960-default-smali/smali/C.smali
deleted file mode 100644
index 08a8508..0000000
--- a/test/960-default-smali/smali/C.smali
+++ /dev/null
@@ -1,37 +0,0 @@
-# /*
-# * Copyright 2015 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 LC;
-.super LA;
-
-# class C extends A {
-# public String SayHiTwice() {
-# return "You don't control me";
-# }
-# }
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, LA;-><init>()V
- return-void
-.end method
-
-.method public SayHiTwice()Ljava/lang/String;
- .registers 1
-
- const-string v0, "You don't control me"
- return-object v0
-.end method
diff --git a/test/960-default-smali/smali/D.smali b/test/960-default-smali/smali/D.smali
deleted file mode 100644
index 32f3b7e..0000000
--- a/test/960-default-smali/smali/D.smali
+++ /dev/null
@@ -1,38 +0,0 @@
-# /*
-# * Copyright 2015 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 LD;
-.super Ljava/lang/Object;
-.implements LGreeter3;
-
-# class D implements Greeter3 {
-# public String GetName() {
-# return "Alex ";
-# }
-# }
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
-.method public GetName()Ljava/lang/String;
- .registers 1
-
- const-string v0, "Alex "
- return-object v0
-.end method
diff --git a/test/960-default-smali/smali/E.smali b/test/960-default-smali/smali/E.smali
deleted file mode 100644
index bae6250..0000000
--- a/test/960-default-smali/smali/E.smali
+++ /dev/null
@@ -1,38 +0,0 @@
-# /*
-# * Copyright 2015 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 LE;
-.super LA;
-.implements LGreeter2;
-
-# class E extends A implements Greeter2 {
-# public String SayHi() {
-# return "Hi2 ";
-# }
-# }
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, LA;-><init>()V
- return-void
-.end method
-
-.method public SayHi()Ljava/lang/String;
- .registers 1
-
- const-string v0, "Hi2 "
- return-object v0
-.end method
diff --git a/test/960-default-smali/smali/Extension.smali b/test/960-default-smali/smali/Extension.smali
deleted file mode 100644
index 60ffa26..0000000
--- a/test/960-default-smali/smali/Extension.smali
+++ /dev/null
@@ -1,30 +0,0 @@
-# /*
-# * Copyright 2015 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 interface LExtension;
-.super Ljava/lang/Object;
-
-# public interface Extension {
-# public default String SayHi() {
-# return "welcome ";
-# }
-# }
-
-.method public SayHi()Ljava/lang/String;
- .locals 1
- const-string v0, "welcome "
- return-object v0
-.end method
diff --git a/test/960-default-smali/smali/F.smali b/test/960-default-smali/smali/F.smali
deleted file mode 100644
index 3eaa089..0000000
--- a/test/960-default-smali/smali/F.smali
+++ /dev/null
@@ -1,47 +0,0 @@
-# /*
-# * Copyright 2015 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 LF;
-.super LA;
-.implements LAttendant;
-
-# class F extends A implements Attendant {
-# public String GetPlace() {
-# return "android";
-# }
-# public String SayHiTwice() {
-# return "We can override both interfaces";
-# }
-# }
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
-.method public SayHiTwice()Ljava/lang/String;
- .registers 1
-
- const-string v0, "We can override both interfaces"
- return-object v0
-.end method
-
-.method public GetPlace()Ljava/lang/String;
- .registers 1
- const-string v0, "android"
- return-object v0
-.end method
diff --git a/test/960-default-smali/smali/G.smali b/test/960-default-smali/smali/G.smali
deleted file mode 100644
index 446f2a4..0000000
--- a/test/960-default-smali/smali/G.smali
+++ /dev/null
@@ -1,37 +0,0 @@
-# /*
-# * Copyright 2015 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 LG;
-.super Ljava/lang/Object;
-.implements LAttendant;
-
-# class G implements Attendant {
-# public String GetPlace() {
-# return "android";
-# }
-# }
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
-.method public GetPlace()Ljava/lang/String;
- .registers 1
- const-string v0, "android"
- return-object v0
-.end method
diff --git a/test/960-default-smali/smali/Greeter.smali b/test/960-default-smali/smali/Greeter.smali
deleted file mode 100644
index 28530ff..0000000
--- a/test/960-default-smali/smali/Greeter.smali
+++ /dev/null
@@ -1,40 +0,0 @@
-# /*
-# * Copyright 2015 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 interface LGreeter;
-.super Ljava/lang/Object;
-
-# public interface Greeter {
-# public String SayHi();
-#
-# public default String SayHiTwice() {
-# return SayHi() + SayHi();
-# }
-# }
-
-.method public abstract SayHi()Ljava/lang/String;
-.end method
-
-.method public SayHiTwice()Ljava/lang/String;
- .locals 2
- invoke-interface {p0}, LGreeter;->SayHi()Ljava/lang/String;
- move-result-object v0
- invoke-interface {p0}, LGreeter;->SayHi()Ljava/lang/String;
- move-result-object v1
- invoke-virtual {v0, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- return-object v0
-.end method
diff --git a/test/960-default-smali/smali/Greeter2.smali b/test/960-default-smali/smali/Greeter2.smali
deleted file mode 100644
index ace1798..0000000
--- a/test/960-default-smali/smali/Greeter2.smali
+++ /dev/null
@@ -1,39 +0,0 @@
-# /*
-# * Copyright 2015 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 interface LGreeter2;
-.super Ljava/lang/Object;
-.implements LGreeter;
-
-# public interface Greeter2 extends Greeter {
-# public default String SayHiTwice() {
-# return "I say " + SayHi() + SayHi();
-# }
-# }
-
-.method public SayHiTwice()Ljava/lang/String;
- .locals 3
- const-string v0, "I say "
- invoke-interface {p0}, LGreeter;->SayHi()Ljava/lang/String;
- move-result-object v1
- invoke-virtual {v0, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- invoke-interface {p0}, LGreeter;->SayHi()Ljava/lang/String;
- move-result-object v1
- invoke-virtual {v0, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- return-object v0
-.end method
diff --git a/test/960-default-smali/smali/Greeter3.smali b/test/960-default-smali/smali/Greeter3.smali
deleted file mode 100644
index 31fc2e7..0000000
--- a/test/960-default-smali/smali/Greeter3.smali
+++ /dev/null
@@ -1,40 +0,0 @@
-# /*
-# * Copyright 2015 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 interface LGreeter3;
-.super Ljava/lang/Object;
-.implements LGreeter;
-
-# public interface Greeter3 extends Greeter {
-# public String GetName();
-#
-# public default String SayHi() {
-# return "Hello " + GetName();
-# }
-# }
-
-.method public abstract GetName()Ljava/lang/String;
-.end method
-
-.method public SayHi()Ljava/lang/String;
- .locals 2
- const-string v0, "Hello "
- invoke-interface {p0}, LGreeter3;->GetName()Ljava/lang/String;
- move-result-object v1
- invoke-virtual {v0, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- return-object v0
-.end method
diff --git a/test/960-default-smali/smali/H.smali b/test/960-default-smali/smali/H.smali
deleted file mode 100644
index 82065ea..0000000
--- a/test/960-default-smali/smali/H.smali
+++ /dev/null
@@ -1,28 +0,0 @@
-# /*
-# * Copyright 2015 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 LH;
-.super Ljava/lang/Object;
-.implements LExtension;
-
-# class H implements Extension {
-# }
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
diff --git a/test/960-default-smali/smali/I.smali b/test/960-default-smali/smali/I.smali
deleted file mode 100644
index 72fb58a..0000000
--- a/test/960-default-smali/smali/I.smali
+++ /dev/null
@@ -1,28 +0,0 @@
-# /*
-# * Copyright 2015 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 LI;
-.super LA;
-.implements LGreeter2;
-
-# class I extends A implements Greeter2 {
-# }
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
diff --git a/test/960-default-smali/smali/J.smali b/test/960-default-smali/smali/J.smali
deleted file mode 100644
index 93f3d62..0000000
--- a/test/960-default-smali/smali/J.smali
+++ /dev/null
@@ -1,29 +0,0 @@
-# /*
-# * Copyright 2015 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 LJ;
-.super LA;
-
-# class J extends A {
-# }
-
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, LA;-><init>()V
- return-void
-.end method
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/960-default-smali/src/A.java
similarity index 77%
copy from test/965-default-verify/build-src/Statics.java
copy to test/960-default-smali/src/A.java
index 300aeec..7664a26 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/960-default-smali/src/A.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright 2015 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.
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+class A implements Greeter {
+ public String SayHi() {
+ return "Hi ";
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/960-default-smali/src/Attendant.java
similarity index 68%
copy from test/965-default-verify/build-src/Statics.java
copy to test/960-default-smali/src/Attendant.java
index 300aeec..9f9a58a 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/960-default-smali/src/Attendant.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright 2015 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.
@@ -13,10 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public interface Attendant {
+ public default String SayHi() {
+ return "welcome to " + GetPlace();
}
+ public default String SayHiTwice() {
+ return SayHi() + SayHi();
+ }
+ public String GetPlace();
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/960-default-smali/src/B.java
similarity index 77%
copy from test/965-default-verify/build-src/Statics.java
copy to test/960-default-smali/src/B.java
index 300aeec..18aaade 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/960-default-smali/src/B.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright 2015 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.
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+class B implements Greeter2 {
+ public String SayHi() {
+ return "Hello ";
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/960-default-smali/src/C.java
similarity index 77%
copy from test/965-default-verify/build-src/Statics.java
copy to test/960-default-smali/src/C.java
index 300aeec..f0bc185 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/960-default-smali/src/C.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright 2015 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.
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+class C extends A {
+ public String SayHiTwice() {
+ return "You don't control me";
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/960-default-smali/src/D.java
similarity index 77%
copy from test/965-default-verify/build-src/Statics.java
copy to test/960-default-smali/src/D.java
index 300aeec..b1697cd 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/960-default-smali/src/D.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright 2015 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.
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+class D implements Greeter3 {
+ public String GetName() {
+ return "Alex ";
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/960-default-smali/src/E.java
similarity index 77%
copy from test/965-default-verify/build-src/Statics.java
copy to test/960-default-smali/src/E.java
index 300aeec..477cb67 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/960-default-smali/src/E.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright 2015 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.
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+class E extends A implements Greeter2 {
+ public String SayHi() {
+ return "Hi2 ";
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/960-default-smali/src/Extension.java
similarity index 77%
copy from test/965-default-verify/build-src/Statics.java
copy to test/960-default-smali/src/Extension.java
index 300aeec..89617dd 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/960-default-smali/src/Extension.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright 2015 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.
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public interface Extension {
+ public default String SayHi() {
+ return "welcome ";
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/960-default-smali/src/F.java
similarity index 71%
copy from test/965-default-verify/build-src/Statics.java
copy to test/960-default-smali/src/F.java
index 300aeec..0282de7 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/960-default-smali/src/F.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright 2015 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.
@@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+class F extends A implements Attendant {
+ public String GetPlace() {
+ return "android";
+ }
+ public String SayHiTwice() {
+ return "We can override both interfaces";
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/960-default-smali/src/G.java
similarity index 77%
copy from test/965-default-verify/build-src/Statics.java
copy to test/960-default-smali/src/G.java
index 300aeec..86a140a 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/960-default-smali/src/G.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright 2015 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.
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+class G implements Attendant {
+ public String GetPlace() {
+ return "android";
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/960-default-smali/src/Greeter.java
similarity index 76%
copy from test/965-default-verify/build-src/Statics.java
copy to test/960-default-smali/src/Greeter.java
index 300aeec..cee2283 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/960-default-smali/src/Greeter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright 2015 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.
@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public interface Greeter {
+ public String SayHi();
+ public default String SayHiTwice() {
+ return SayHi() + SayHi();
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/960-default-smali/src/Greeter2.java
similarity index 76%
copy from test/965-default-verify/build-src/Statics.java
copy to test/960-default-smali/src/Greeter2.java
index 300aeec..07f6c53 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/960-default-smali/src/Greeter2.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright 2015 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.
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public interface Greeter2 extends Greeter {
+ public default String SayHiTwice() {
+ return "I say " + SayHi() + SayHi();
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/960-default-smali/src/Greeter3.java
similarity index 74%
copy from test/965-default-verify/build-src/Statics.java
copy to test/960-default-smali/src/Greeter3.java
index 300aeec..bbb7171 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/960-default-smali/src/Greeter3.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright 2015 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.
@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public interface Greeter3 extends Greeter {
+ public String GetName();
+ public default String SayHi() {
+ return "Hello " + GetName();
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/960-default-smali/src/H.java
similarity index 76%
copy from test/965-default-verify/build-src/Statics.java
copy to test/960-default-smali/src/H.java
index 300aeec..d87a6db 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/960-default-smali/src/H.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright 2015 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.
@@ -13,10 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
- }
-}
-
+class H implements Extension { }
diff --git a/test/965-default-verify/build-src/Statics.java b/test/960-default-smali/src/I.java
similarity index 76%
copy from test/965-default-verify/build-src/Statics.java
copy to test/960-default-smali/src/I.java
index 300aeec..8d6779c 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/960-default-smali/src/I.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright 2015 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.
@@ -13,10 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
- }
-}
-
+class I extends A implements Greeter2 { }
diff --git a/test/965-default-verify/build-src/Statics.java b/test/960-default-smali/src/J.java
similarity index 76%
copy from test/965-default-verify/build-src/Statics.java
copy to test/960-default-smali/src/J.java
index 300aeec..a365e40 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/960-default-smali/src/J.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright 2015 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.
@@ -13,10 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
- }
-}
-
+class J extends A { }
diff --git a/test/960-default-smali/smali/classes.xml b/test/960-default-smali/src/classes.xml
similarity index 100%
rename from test/960-default-smali/smali/classes.xml
rename to test/960-default-smali/src/classes.xml
diff --git a/test/961-default-iface-resolution-generated/build b/test/961-default-iface-resolution-generated/build
index 005f76c..ccebbe4 100755
--- a/test/961-default-iface-resolution-generated/build
+++ b/test/961-default-iface-resolution-generated/build
@@ -26,32 +26,19 @@
}
trap 'restore_ulimit' ERR
-mkdir -p ./smali
+if [[ $@ != *"--jvm"* ]]; then
+ # Don't do anything with jvm
+ # Hard-wired use of experimental jack.
+ # TODO: fix this temporary work-around for default-methods, see b/19467889
+ export USE_JACK=true
+fi
+
+mkdir -p ./src
# Generate the smali files and expected.txt or fail
-./util-src/generate_smali.py ./smali ./expected.txt
+./util-src/generate_java.py ./src ./expected.txt
-# Should we compile with Java source code. By default we will use Smali.
-USES_JAVA_SOURCE="false"
-if [[ $@ == *"--jvm"* ]]; then
- USES_JAVA_SOURCE="true"
-elif [[ $USE_JACK == "true" ]]; then
- if "$JACK" -D jack.java.source.version=1.8 >& /dev/null; then
- USES_JAVA_SOURCE="true"
- else
- echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2
- fi
-fi
-
-if [[ "$USES_JAVA_SOURCE" == "true" ]]; then
- # We are compiling java code, create it.
- mkdir -p src
- ${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src
- # Ignore the smali directory.
- EXTRA_ARGS="--no-smali"
-fi
-
-./default-build "$@" "$EXTRA_ARGS" --experimental default-methods
+./default-build "$@" --experimental default-methods
# Reset the ulimit back to its initial value
restore_ulimit
diff --git a/test/961-default-iface-resolution-generated/util-src/generate_smali.py b/test/961-default-iface-resolution-generated/util-src/generate_java.py
similarity index 71%
rename from test/961-default-iface-resolution-generated/util-src/generate_smali.py
rename to test/961-default-iface-resolution-generated/util-src/generate_java.py
index 921a096..a205cd6 100755
--- a/test/961-default-iface-resolution-generated/util-src/generate_smali.py
+++ b/test/961-default-iface-resolution-generated/util-src/generate_java.py
@@ -15,7 +15,7 @@
# limitations under the License.
"""
-Generate Smali test files for test 961.
+Generate Java test files for test 961.
"""
import os
@@ -43,48 +43,27 @@
# every possible interface tree up to 5 layers deep.
MAX_IFACE_DEPTH = 5
-class MainClass(mixins.DumpMixin, mixins.Named, mixins.SmaliFileMixin):
+class MainClass(mixins.DumpMixin, mixins.Named, mixins.JavaFileMixin):
"""
- A Main.smali file containing the Main class and the main function. It will run
+ A Main.java file containing the Main class and the main function. It will run
all the test functions we have.
"""
MAIN_CLASS_TEMPLATE = """{copyright}
-
-.class public LMain;
-.super Ljava/lang/Object;
-
-# class Main {{
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {{p0}}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
+class Main {{
{test_groups}
-
{main_func}
-
-# }}
+}}
"""
MAIN_FUNCTION_TEMPLATE = """
-# public static void main(String[] args) {{
-.method public static main([Ljava/lang/String;)V
- .locals 2
- sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
-
+ public static void main(String[] args) {{
{test_group_invoke}
-
- return-void
-.end method
-# }}
+ }}
"""
TEST_GROUP_INVOKE_TEMPLATE = """
-# {test_name}();
- invoke-static {{}}, {test_name}()V
+ {test_name}();
"""
def __init__(self):
@@ -114,7 +93,7 @@
def __str__(self):
"""
- Print the MainClass smali code.
+ Print the MainClass java code.
"""
all_tests = sorted(self.tests)
test_invoke = ""
@@ -125,7 +104,7 @@
test_invoke += self.TEST_GROUP_INVOKE_TEMPLATE.format(test_name=t.get_name())
main_func = self.MAIN_FUNCTION_TEMPLATE.format(test_group_invoke=test_invoke)
- return self.MAIN_CLASS_TEMPLATE.format(copyright = get_copyright("smali"),
+ return self.MAIN_CLASS_TEMPLATE.format(copyright = get_copyright("java"),
test_groups = test_groups,
main_func = main_func)
@@ -136,49 +115,18 @@
"""
TEST_FUNCTION_TEMPLATE = """
-# public static void {fname}() {{
-# try {{
-# {farg} v = new {farg}();
-# System.out.printf("%s calls default method on %s\\n",
-# v.CalledClassName(),
-# v.CalledInterfaceName());
-# return;
-# }} catch (Error e) {{
-# e.printStackTrace(System.out);
-# return;
-# }}
-# }}
-.method public static {fname}()V
- .locals 7
- :call_{fname}_try_start
- new-instance v6, L{farg};
- invoke-direct {{v6}}, L{farg};-><init>()V
-
- const/4 v0, 2
- new-array v1,v0, [Ljava/lang/Object;
- const/4 v0, 0
- invoke-virtual {{v6}}, L{farg};->CalledClassName()Ljava/lang/String;
- move-result-object v4
- aput-object v4,v1,v0
-
- sget-object v2, Ljava/lang/System;->out:Ljava/io/PrintStream;
- const-string v3, "%s calls default method on %s\\n"
-
- invoke-virtual {{v6}}, L{farg};->CalledInterfaceName()Ljava/lang/String;
- move-result-object v4
- const/4 v0, 1
- aput-object v4, v1, v0
-
- invoke-virtual {{v2,v3,v1}}, Ljava/io/PrintStream;->printf(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;
- return-void
- :call_{fname}_try_end
- .catch Ljava/lang/Error; {{:call_{fname}_try_start .. :call_{fname}_try_end}} :error_{fname}_start
- :error_{fname}_start
- move-exception v3
- sget-object v2, Ljava/lang/System;->out:Ljava/io/PrintStream;
- invoke-virtual {{v3,v2}}, Ljava/lang/Error;->printStackTrace(Ljava/io/PrintStream;)V
- return-void
-.end method
+ public static void {fname}() {{
+ try {{
+ {farg} v = new {farg}();
+ System.out.printf("%s calls default method on %s\\n",
+ v.CalledClassName(),
+ v.CalledInterfaceName());
+ return;
+ }} catch (Error e) {{
+ e.printStackTrace(System.out);
+ return;
+ }}
+ }}
"""
def __init__(self, farg):
@@ -202,38 +150,21 @@
def __str__(self):
"""
- Print the smali code of this function.
+ Print the java code of this function.
"""
return self.TEST_FUNCTION_TEMPLATE.format(fname=self.get_name(), farg=self.farg.get_name())
-class TestClass(mixins.DumpMixin, mixins.Named, mixins.NameComparableMixin, mixins.SmaliFileMixin):
+class TestClass(mixins.DumpMixin, mixins.Named, mixins.NameComparableMixin, mixins.JavaFileMixin):
"""
A class that will be instantiated to test default method resolution order.
"""
TEST_CLASS_TEMPLATE = """{copyright}
-
-.class public L{class_name};
-.super Ljava/lang/Object;
-.implements L{iface_name};
-
-# public class {class_name} implements {iface_name} {{
-# public String CalledClassName() {{
-# return "{tree}";
-# }}
-# }}
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {{p0}}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
-.method public CalledClassName()Ljava/lang/String;
- .locals 1
- const-string v0, "{tree}"
- return-object v0
-.end method
+public class {class_name} implements {iface_name} {{
+ public String CalledClassName() {{
+ return "{tree}";
+ }}
+}}
"""
def __init__(self, iface):
@@ -276,46 +207,30 @@
def __str__(self):
"""
- Print the smali code of this class.
+ Print the java code of this class.
"""
- return self.TEST_CLASS_TEMPLATE.format(copyright = get_copyright('smali'),
+ return self.TEST_CLASS_TEMPLATE.format(copyright = get_copyright('java'),
iface_name = self.iface.get_name(),
tree = self.get_tree(),
class_name = self.class_name)
-class TestInterface(mixins.DumpMixin, mixins.Named, mixins.NameComparableMixin, mixins.SmaliFileMixin):
+class TestInterface(mixins.DumpMixin, mixins.Named, mixins.NameComparableMixin, mixins.JavaFileMixin):
"""
An interface that will be used to test default method resolution order.
"""
TEST_INTERFACE_TEMPLATE = """{copyright}
-.class public abstract interface L{class_name};
-.super Ljava/lang/Object;
-{implements_spec}
-
-# public interface {class_name} {extends} {ifaces} {{
-# public String CalledClassName();
-.method public abstract CalledClassName()Ljava/lang/String;
-.end method
+public interface {class_name} {extends} {ifaces} {{
+ public String CalledClassName();
{funcs}
-
-# }}
+}}
"""
DEFAULT_FUNC_TEMPLATE = """
-# public default String CalledInterfaceName() {{
-# return "{tree}";
-# }}
-.method public CalledInterfaceName()Ljava/lang/String;
- .locals 1
- const-string v0, "{tree}"
- return-object v0
-.end method
-"""
-
- IMPLEMENTS_TEMPLATE = """
-.implements L{iface_name};
+ public default String CalledInterfaceName() {{
+ return "{tree}";
+ }}
"""
def __init__(self, ifaces, default):
@@ -357,12 +272,10 @@
def __str__(self):
"""
- Print the smali code of this interface.
+ Print the java code of this interface.
"""
- s_ifaces = " "
j_ifaces = " "
for i in self.ifaces:
- s_ifaces += self.IMPLEMENTS_TEMPLATE.format(iface_name = i.get_name())
j_ifaces += " {},".format(i.get_name())
j_ifaces = j_ifaces[0:-1]
if self.default:
@@ -371,8 +284,7 @@
class_name = self.class_name)
else:
funcs = ""
- return self.TEST_INTERFACE_TEMPLATE.format(copyright = get_copyright('smali'),
- implements_spec = s_ifaces,
+ return self.TEST_INTERFACE_TEMPLATE.format(copyright = get_copyright('java'),
extends = "extends" if len(self.ifaces) else "",
ifaces = j_ifaces,
funcs = funcs,
@@ -451,16 +363,16 @@
return mc, classes
def main(argv):
- smali_dir = Path(argv[1])
- if not smali_dir.exists() or not smali_dir.is_dir():
- print("{} is not a valid smali dir".format(smali_dir), file=sys.stderr)
+ java_dir = Path(argv[1])
+ if not java_dir.exists() or not java_dir.is_dir():
+ print("{} is not a valid java dir".format(java_dir), file=sys.stderr)
sys.exit(1)
expected_txt = Path(argv[2])
mainclass, all_files = create_all_test_files()
with expected_txt.open('w') as out:
print(mainclass.get_expected(), file=out)
for f in all_files:
- f.dump(smali_dir)
+ f.dump(java_dir)
if __name__ == '__main__':
main(sys.argv)
diff --git a/test/962-iface-static/build b/test/962-iface-static/build
index e17272f..0dd8573 100755
--- a/test/962-iface-static/build
+++ b/test/962-iface-static/build
@@ -17,24 +17,11 @@
# make us exit on a failure
set -e
-# Should we compile with Java source code. By default we will use Smali.
-USES_JAVA_SOURCE="false"
-if [[ $@ == *"--jvm"* ]]; then
- USES_JAVA_SOURCE="true"
-elif [[ "$USE_JACK" == "true" ]]; then
- if $JACK -D jack.java.source.version=1.8 2>/dev/null; then
- USES_JAVA_SOURCE="true"
- else
- echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2
- fi
+if [[ $@ != *"--jvm"* ]]; then
+ # Don't do anything with jvm
+ # Hard-wired use of experimental jack.
+ # TODO: fix this temporary work-around for default-methods, see b/19467889
+ export USE_JACK=true
fi
-if [[ "$USES_JAVA_SOURCE" == "true" ]]; then
- # We are compiling java code, create it.
- mkdir -p src
- ${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src
- # Ignore the smali directory.
- EXTRA_ARGS="--no-smali"
-fi
-
-./default-build "$@" "$EXTRA_ARGS" --experimental default-methods
+./default-build "$@" --experimental default-methods
diff --git a/test/962-iface-static/smali/Displayer.smali b/test/962-iface-static/smali/Displayer.smali
deleted file mode 100644
index ed4c013..0000000
--- a/test/962-iface-static/smali/Displayer.smali
+++ /dev/null
@@ -1,45 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public class Displayer {
-# static {
-# System.out.println("init");
-# }
-#
-# public Displayer() {
-# System.out.println("constructor");
-# }
-# }
-
-.class public LDisplayer;
-.super Ljava/lang/Object;
-
-.method static constructor <clinit>()V
- .locals 3
- sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
- const-string v0, "init"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- return-void
-.end method
-
-.method public constructor <init>()V
- .locals 2
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
- const-string v0, "constructor"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- return-void
-.end method
diff --git a/test/962-iface-static/smali/Main.smali b/test/962-iface-static/smali/Main.smali
deleted file mode 100644
index 72fa5e0..0000000
--- a/test/962-iface-static/smali/Main.smali
+++ /dev/null
@@ -1,40 +0,0 @@
-# /*
-# * Copyright (C) 2015 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 Main {
-# public static void main(String[] args) {
-# System.out.println(iface.SayHi());
-# }
-# }
-.class public LMain;
-.super Ljava/lang/Object;
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
-.method public static main([Ljava/lang/String;)V
- .locals 2
- sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
-
- invoke-static {}, Liface;->SayHi()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- return-void
-.end method
diff --git a/test/962-iface-static/smali/iface.smali b/test/962-iface-static/smali/iface.smali
deleted file mode 100644
index 5b9c03e..0000000
--- a/test/962-iface-static/smali/iface.smali
+++ /dev/null
@@ -1,43 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public interface iface {
-# public static final Displayer f = new Displayer();
-#
-# public static String SayHi() {
-# return "Hello";
-# }
-# }
-
-.class public abstract interface Liface;
-.super Ljava/lang/Object;
-
-.field public final static f:LDisplayer;
-
-.method static constructor <clinit>()V
- .locals 3
- new-instance v1, LDisplayer;
- invoke-direct {v1}, LDisplayer;-><init>()V
- sput-object v1, Liface;->f:LDisplayer;
- return-void
-.end method
-
-.method public static SayHi()Ljava/lang/String;
- .locals 1
- const-string v0, "Hello"
- return-object v0
-.end method
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/962-iface-static/src/Displayer.java
similarity index 81%
copy from test/965-default-verify/build-src/Statics.java
copy to test/962-iface-static/src/Displayer.java
index 300aeec..5b28b3f 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/962-iface-static/src/Displayer.java
@@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public class Displayer {
+ static {
+ System.out.println("init");
+ }
+ public Displayer() {
+ System.out.println("constructor");
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/962-iface-static/src/Iface.java
similarity index 82%
copy from test/965-default-verify/build-src/Statics.java
copy to test/962-iface-static/src/Iface.java
index 300aeec..82c7808 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/962-iface-static/src/Iface.java
@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public interface Iface {
+ public static final Displayer f = new Displayer();
+ public static String SayHi() {
+ return "Hello";
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/962-iface-static/src/Main.java
similarity index 84%
copy from test/965-default-verify/build-src/Statics.java
copy to test/962-iface-static/src/Main.java
index 300aeec..7cb8eb7 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/962-iface-static/src/Main.java
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+class Main {
+ public static void main(String[] args) {
+ System.out.println(Iface.SayHi());
}
}
-
diff --git a/test/963-default-range-smali/build b/test/963-default-range-smali/build
index e17272f..0dd8573 100755
--- a/test/963-default-range-smali/build
+++ b/test/963-default-range-smali/build
@@ -17,24 +17,11 @@
# make us exit on a failure
set -e
-# Should we compile with Java source code. By default we will use Smali.
-USES_JAVA_SOURCE="false"
-if [[ $@ == *"--jvm"* ]]; then
- USES_JAVA_SOURCE="true"
-elif [[ "$USE_JACK" == "true" ]]; then
- if $JACK -D jack.java.source.version=1.8 2>/dev/null; then
- USES_JAVA_SOURCE="true"
- else
- echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2
- fi
+if [[ $@ != *"--jvm"* ]]; then
+ # Don't do anything with jvm
+ # Hard-wired use of experimental jack.
+ # TODO: fix this temporary work-around for default-methods, see b/19467889
+ export USE_JACK=true
fi
-if [[ "$USES_JAVA_SOURCE" == "true" ]]; then
- # We are compiling java code, create it.
- mkdir -p src
- ${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src
- # Ignore the smali directory.
- EXTRA_ARGS="--no-smali"
-fi
-
-./default-build "$@" "$EXTRA_ARGS" --experimental default-methods
+./default-build "$@" --experimental default-methods
diff --git a/test/963-default-range-smali/smali/A.smali b/test/963-default-range-smali/smali/A.smali
deleted file mode 100644
index b3d91dd..0000000
--- a/test/963-default-range-smali/smali/A.smali
+++ /dev/null
@@ -1,29 +0,0 @@
-# /*
-# * Copyright 2015 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 LA;
-.super Ljava/lang/Object;
-.implements Liface;
-
-# class A implements iface {
-# }
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
diff --git a/test/963-default-range-smali/smali/Main.smali b/test/963-default-range-smali/smali/Main.smali
deleted file mode 100644
index 400fba7..0000000
--- a/test/963-default-range-smali/smali/Main.smali
+++ /dev/null
@@ -1,77 +0,0 @@
-# /*
-# * Copyright (C) 2015 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 Main {
-# public static void main(String[] args) {
-# A a = new A();
-# System.out.println(a.SayHi("a string 0",
-# "a string 1",
-# "a string 2",
-# "a string 3",
-# "a string 4",
-# "a string 5",
-# "a string 6",
-# "a string 7",
-# "a string 8",
-# "a string 9"));
-# iface b = (iface)a;
-# System.out.println(b.SayHi("a string 0",
-# "a string 1",
-# "a string 2",
-# "a string 3",
-# "a string 4",
-# "a string 5",
-# "a string 6",
-# "a string 7",
-# "a string 8",
-# "a string 9"));
-# }
-# }
-.class public LMain;
-.super Ljava/lang/Object;
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
-.method public static main([Ljava/lang/String;)V
- .locals 15
- sget-object v12, Ljava/lang/System;->out:Ljava/io/PrintStream;
-
- new-instance v1, LA;
- invoke-direct {v1}, LA;-><init>()V
- const-string v2, "a string 0"
- const-string v3, "a string 1"
- const-string v4, "a string 2"
- const-string v5, "a string 3"
- const-string v6, "a string 4"
- const-string v7, "a string 5"
- const-string v8, "a string 6"
- const-string v9, "a string 7"
- const-string v10, "a string 8"
- const-string v11, "a string 9"
- invoke-virtual/range {v1 .. v11}, LA;->SayHi(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v12,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- invoke-interface/range {v1 .. v11}, Liface;->SayHi(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v12,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- return-void
-.end method
diff --git a/test/963-default-range-smali/smali/iface.smali b/test/963-default-range-smali/smali/iface.smali
deleted file mode 100644
index c2c3ce6..0000000
--- a/test/963-default-range-smali/smali/iface.smali
+++ /dev/null
@@ -1,40 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public interface iface {
-# public default String SayHi(String n1,
-# String n2,
-# String n3,
-# String n4,
-# String n5,
-# String n6,
-# String n7,
-# String n8,
-# String n9,
-# String n0) {
-# return "Hello";
-# }
-# }
-
-.class public abstract interface Liface;
-.super Ljava/lang/Object;
-
-.method public SayHi(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
- .locals 1
- const-string v0, "Hello"
- return-object v0
-.end method
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/963-default-range-smali/src/A.java
similarity index 76%
copy from test/965-default-verify/build-src/Statics.java
copy to test/963-default-range-smali/src/A.java
index 300aeec..617eccb 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/963-default-range-smali/src/A.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Android Open Source Project
+ * Copyright 2015 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.
@@ -13,10 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
- }
-}
-
+class A implements Iface { }
diff --git a/test/963-default-range-smali/src/Iface.java b/test/963-default-range-smali/src/Iface.java
new file mode 100644
index 0000000..7556209
--- /dev/null
+++ b/test/963-default-range-smali/src/Iface.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+public interface Iface {
+ public default String SayHi(String n1,
+ String n2,
+ String n3,
+ String n4,
+ String n5,
+ String n6,
+ String n7,
+ String n8,
+ String n9,
+ String n0) {
+ return "Hello";
+ }
+}
diff --git a/test/963-default-range-smali/src/Main.java b/test/963-default-range-smali/src/Main.java
new file mode 100644
index 0000000..841842d
--- /dev/null
+++ b/test/963-default-range-smali/src/Main.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 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 Main {
+ public static void main(String[] args) {
+ A a = new A();
+ System.out.println(a.SayHi("a string 0",
+ "a string 1",
+ "a string 2",
+ "a string 3",
+ "a string 4",
+ "a string 5",
+ "a string 6",
+ "a string 7",
+ "a string 8",
+ "a string 9"));
+ Iface b = a;
+ System.out.println(b.SayHi("a string 0",
+ "a string 1",
+ "a string 2",
+ "a string 3",
+ "a string 4",
+ "a string 5",
+ "a string 6",
+ "a string 7",
+ "a string 8",
+ "a string 9"));
+ }
+}
diff --git a/test/964-default-iface-init-generated/build b/test/964-default-iface-init-generated/build
index 0780da1..ccebbe4 100755
--- a/test/964-default-iface-init-generated/build
+++ b/test/964-default-iface-init-generated/build
@@ -26,30 +26,19 @@
}
trap 'restore_ulimit' ERR
+if [[ $@ != *"--jvm"* ]]; then
+ # Don't do anything with jvm
+ # Hard-wired use of experimental jack.
+ # TODO: fix this temporary work-around for default-methods, see b/19467889
+ export USE_JACK=true
+fi
+
+mkdir -p ./src
+
# Generate the smali files and expected.txt or fail
-./util-src/generate_smali.py ./smali ./expected.txt
+./util-src/generate_java.py ./src ./expected.txt
-# Should we compile with Java source code. By default we will use Smali.
-USES_JAVA_SOURCE="false"
-if [[ $@ == *"--jvm"* ]]; then
- USES_JAVA_SOURCE="true"
-elif [[ "$USE_JACK" == "true" ]]; then
- if $JACK -D jack.java.source.version=1.8 2>/dev/null; then
- USES_JAVA_SOURCE="true"
- else
- echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2
- fi
-fi
-
-if [[ "$USES_JAVA_SOURCE" == "true" ]]; then
- # We are compiling java code, create it.
- mkdir -p src
- ${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src
- # Ignore the smali directory.
- EXTRA_ARGS="--no-smali"
-fi
-
-./default-build "$@" "$EXTRA_ARGS" --experimental default-methods
+./default-build "$@" --experimental default-methods
# Reset the ulimit back to its initial value
restore_ulimit
diff --git a/test/964-default-iface-init-generated/smali/Displayer.smali b/test/964-default-iface-init-generated/smali/Displayer.smali
deleted file mode 100644
index 91280a8..0000000
--- a/test/964-default-iface-init-generated/smali/Displayer.smali
+++ /dev/null
@@ -1,45 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# // This class is b/c java does not allow static {} blocks in interfaces.
-# public class Displayer {
-# public Displayer(String type) {
-# System.out.println("initialization of " + type);
-# }
-# public void touch() {
-# return;
-# }
-# }
-
-.class public LDisplayer;
-.super Ljava/lang/Object;
-
-.method public constructor <init>(Ljava/lang/String;)V
- .locals 2
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- const-string v0, "initialization of "
- invoke-virtual {v0, p1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- return-void
-.end method
-
-.method public touch()V
- .locals 0
- return-void
-.end method
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/964-default-iface-init-generated/src/Displayer.java
similarity index 73%
copy from test/965-default-verify/build-src/Statics.java
copy to test/964-default-iface-init-generated/src/Displayer.java
index 300aeec..4be0ab2 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/964-default-iface-init-generated/src/Displayer.java
@@ -13,10 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+// This class is b/c java does not allow static {} blocks in interfaces.
+public class Displayer {
+ public Displayer(String type) {
+ System.out.println("initialization of " + type);
+ }
+ public void touch() {
+ return;
}
}
-
diff --git a/test/964-default-iface-init-generated/util-src/generate_smali.py b/test/964-default-iface-init-generated/util-src/generate_java.py
similarity index 68%
rename from test/964-default-iface-init-generated/util-src/generate_smali.py
rename to test/964-default-iface-init-generated/util-src/generate_java.py
index c0ba157..b2df49f 100755
--- a/test/964-default-iface-init-generated/util-src/generate_smali.py
+++ b/test/964-default-iface-init-generated/util-src/generate_java.py
@@ -15,7 +15,7 @@
# limitations under the License.
"""
-Generate Smali test files for test 964.
+Generate java test files for test 964.
"""
import os
@@ -40,47 +40,27 @@
# The max depth the tree can have.
MAX_IFACE_DEPTH = 3
-class MainClass(mixins.DumpMixin, mixins.Named, mixins.SmaliFileMixin):
+class MainClass(mixins.DumpMixin, mixins.Named, mixins.JavaFileMixin):
"""
- A Main.smali file containing the Main class and the main function. It will run
+ A Main.java file containing the Main class and the main function. It will run
all the test functions we have.
"""
MAIN_CLASS_TEMPLATE = """{copyright}
-
-.class public LMain;
-.super Ljava/lang/Object;
-
-# class Main {{
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {{p0}}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
+class Main {{
{test_groups}
-
{main_func}
-
-# }}
+}}
"""
MAIN_FUNCTION_TEMPLATE = """
-# public static void main(String[] args) {{
-.method public static main([Ljava/lang/String;)V
- .locals 2
-
+ public static void main(String[] args) {{
{test_group_invoke}
-
- return-void
-.end method
-# }}
+ }}
"""
TEST_GROUP_INVOKE_TEMPLATE = """
-# {test_name}();
- invoke-static {{}}, {test_name}()V
+ {test_name}();
"""
def __init__(self):
@@ -110,7 +90,7 @@
def __str__(self):
"""
- Print the smali code for this test.
+ Print the java code for this test.
"""
all_tests = sorted(self.tests)
test_invoke = ""
@@ -121,7 +101,7 @@
test_invoke += self.TEST_GROUP_INVOKE_TEMPLATE.format(test_name=t.get_name())
main_func = self.MAIN_FUNCTION_TEMPLATE.format(test_group_invoke=test_invoke)
- return self.MAIN_CLASS_TEMPLATE.format(copyright = get_copyright('smali'),
+ return self.MAIN_CLASS_TEMPLATE.format(copyright = get_copyright('java'),
test_groups = test_groups,
main_func = main_func)
@@ -132,46 +112,19 @@
"""
TEST_FUNCTION_TEMPLATE = """
-# public static void {fname}() {{
-# try {{
-# System.out.println("About to initialize {tree}");
-# {farg} v = new {farg}();
-# System.out.println("Initialized {tree}");
-# v.touchAll();
-# System.out.println("All of {tree} hierarchy initialized");
-# return;
-# }} catch (Error e) {{
-# e.printStackTrace(System.out);
-# return;
-# }}
-# }}
-.method public static {fname}()V
- .locals 7
- :call_{fname}_try_start
- sget-object v2, Ljava/lang/System;->out:Ljava/io/PrintStream;
- const-string v3, "About to initialize {tree}"
- invoke-virtual {{v2, v3}}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- new-instance v6, L{farg};
- invoke-direct {{v6}}, L{farg};-><init>()V
-
- const-string v3, "Initialized {tree}"
- invoke-virtual {{v2, v3}}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- invoke-virtual {{v6}}, L{farg};->touchAll()V
-
- const-string v3, "All of {tree} hierarchy initialized"
- invoke-virtual {{v2, v3}}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- return-void
- :call_{fname}_try_end
- .catch Ljava/lang/Error; {{:call_{fname}_try_start .. :call_{fname}_try_end}} :error_{fname}_start
- :error_{fname}_start
- move-exception v3
- sget-object v2, Ljava/lang/System;->out:Ljava/io/PrintStream;
- invoke-virtual {{v3,v2}}, Ljava/lang/Error;->printStackTrace(Ljava/io/PrintStream;)V
- return-void
-.end method
+ public static void {fname}() {{
+ try {{
+ System.out.println("About to initialize {tree}");
+ {farg} v = new {farg}();
+ System.out.println("Initialized {tree}");
+ v.touchAll();
+ System.out.println("All of {tree} hierarchy initialized");
+ return;
+ }} catch (Error e) {{
+ e.printStackTrace(System.out);
+ return;
+ }}
+ }}
"""
OUTPUT_FORMAT = """
@@ -190,7 +143,7 @@
def __str__(self):
"""
- Print the smali code for this test function.
+ Print the java code for this test function.
"""
return self.TEST_FUNCTION_TEMPLATE.format(fname=self.get_name(),
farg=self.farg.get_name(),
@@ -211,57 +164,26 @@
initialize_output = self.farg.get_initialize_output().strip(),
touch_output = self.farg.get_touch_output().strip())
-class TestClass(mixins.DumpMixin, mixins.Named, mixins.NameComparableMixin, mixins.SmaliFileMixin):
+class TestClass(mixins.DumpMixin, mixins.Named, mixins.NameComparableMixin, mixins.JavaFileMixin):
"""
A class that will be instantiated to test interface initialization order.
"""
TEST_CLASS_TEMPLATE = """{copyright}
+public class {class_name} implements {ifaces} {{
+ public void marker() {{
+ return;
+ }}
-.class public L{class_name};
-.super Ljava/lang/Object;
-{implements_spec}
-
-# public class {class_name} implements {ifaces} {{
-#
-# public {class_name}() {{
-# }}
-.method public constructor <init>()V
- .locals 2
- invoke-direct {{p0}}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
-# public void marker() {{
-# return;
-# }}
-.method public marker()V
- .locals 0
- return-void
-.end method
-
-# public void touchAll() {{
-.method public touchAll()V
- .locals 2
- sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream;
- {touch_calls}
- return-void
-.end method
-# }}
-# }}
-"""
-
- IMPLEMENTS_TEMPLATE = """
-.implements L{iface_name};
+ public void touchAll() {{
+{touch_calls}
+ }}
+}}
"""
TOUCH_CALL_TEMPLATE = """
-# System.out.println("{class_name} touching {iface_name}");
-# {iface_name}.field.touch();
- const-string v1, "{class_name} touching {iface_name}"
- invoke-virtual {{v0, v1}}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- sget-object v1, L{iface_name};->field:LDisplayer;
- invoke-virtual {{v1}}, LDisplayer;->touch()V
+ System.out.println("{class_name} touching {iface_name}");
+ {iface_name}.field.touch();
"""
TOUCH_OUTPUT_TEMPLATE = """
@@ -306,63 +228,32 @@
def __str__(self):
"""
- Print the smali code for this class.
+ Print the java code for this class.
"""
- s_ifaces = '\n'.join(map(lambda a: self.IMPLEMENTS_TEMPLATE.format(iface_name = a.get_name()),
- self.ifaces))
j_ifaces = ', '.join(map(lambda a: a.get_name(), self.ifaces))
touches = '\n'.join(map(lambda a: self.TOUCH_CALL_TEMPLATE.format(class_name = self.class_name,
iface_name = a.get_name()),
self.get_all_interfaces()))
- return self.TEST_CLASS_TEMPLATE.format(copyright = get_copyright('smali'),
- implements_spec = s_ifaces,
+ return self.TEST_CLASS_TEMPLATE.format(copyright = get_copyright('java'),
ifaces = j_ifaces,
class_name = self.class_name,
touch_calls = touches)
-class TestInterface(mixins.DumpMixin, mixins.Named, mixins.NameComparableMixin, mixins.SmaliFileMixin):
+class TestInterface(mixins.DumpMixin, mixins.Named, mixins.NameComparableMixin, mixins.JavaFileMixin):
"""
An interface that will be used to test default method resolution order.
"""
TEST_INTERFACE_TEMPLATE = """{copyright}
-.class public abstract interface L{class_name};
-.super Ljava/lang/Object;
-{implements_spec}
-
-# public interface {class_name} {extends} {ifaces} {{
-# public static final Displayer field = new Displayer("{tree}");
-.field public final static field:LDisplayer;
-
-.method static constructor <clinit>()V
- .locals 3
- const-string v2, "{tree}"
- new-instance v1, LDisplayer;
- invoke-direct {{v1, v2}}, LDisplayer;-><init>(Ljava/lang/String;)V
- sput-object v1, L{class_name};->field:LDisplayer;
- return-void
-.end method
-
-# public void marker();
-.method public abstract marker()V
-.end method
-
+public interface {class_name} {extends} {ifaces} {{
+ public static final Displayer field = new Displayer("{tree}");
+ public void marker();
{funcs}
-
-# }}
+}}
"""
DEFAULT_FUNC_TEMPLATE = """
-# public default void {class_name}_DEFAULT_FUNC() {{
-# return;
-# }}
-.method public {class_name}_DEFAULT_FUNC()V
- .locals 0
- return-void
-.end method
-"""
- IMPLEMENTS_TEMPLATE = """
-.implements L{iface_name};
+ public default void {class_name}_DEFAULT_FUNC() {{ return; }}
"""
OUTPUT_TEMPLATE = "initialization of {tree}"
@@ -429,17 +320,14 @@
def __str__(self):
"""
- Print the smali code for this interface.
+ Print the java code for this interface.
"""
- s_ifaces = '\n'.join(map(lambda a: self.IMPLEMENTS_TEMPLATE.format(iface_name = a.get_name()),
- self.ifaces))
j_ifaces = ', '.join(map(lambda a: a.get_name(), self.ifaces))
if self.default:
funcs = self.DEFAULT_FUNC_TEMPLATE.format(class_name = self.class_name)
else:
funcs = ""
- return self.TEST_INTERFACE_TEMPLATE.format(copyright = get_copyright('smali'),
- implements_spec = s_ifaces,
+ return self.TEST_INTERFACE_TEMPLATE.format(copyright = get_copyright('java'),
extends = "extends" if len(self.ifaces) else "",
ifaces = j_ifaces,
funcs = funcs,
@@ -516,16 +404,16 @@
return mc, classes
def main(argv):
- smali_dir = Path(argv[1])
- if not smali_dir.exists() or not smali_dir.is_dir():
- print("{} is not a valid smali dir".format(smali_dir), file=sys.stderr)
+ java_dir = Path(argv[1])
+ if not java_dir.exists() or not java_dir.is_dir():
+ print("{} is not a valid java dir".format(java_dir), file=sys.stderr)
sys.exit(1)
expected_txt = Path(argv[2])
mainclass, all_files = create_all_test_files()
with expected_txt.open('w') as out:
print(mainclass.get_expected(), file=out)
for f in all_files:
- f.dump(smali_dir)
+ f.dump(java_dir)
if __name__ == '__main__':
main(sys.argv)
diff --git a/test/965-default-verify/build b/test/965-default-verify/build
index 5ba5438..0dd8573 100755
--- a/test/965-default-verify/build
+++ b/test/965-default-verify/build
@@ -17,32 +17,11 @@
# make us exit on a failure
set -e
-# Should we compile with Java source code. By default we will use Smali.
-USES_JAVA_SOURCE="false"
-if [[ $@ == *"--jvm"* ]]; then
- USES_JAVA_SOURCE="true"
-elif [[ "$USE_JACK" == "true" ]]; then
- if $JACK -D jack.java.source.version=1.8 2>/dev/null; then
- USES_JAVA_SOURCE="true"
- else
- echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2
- fi
+if [[ $@ != *"--jvm"* ]]; then
+ # Don't do anything with jvm
+ # Hard-wired use of experimental jack.
+ # TODO: fix this temporary work-around for default-methods, see b/19467889
+ export USE_JACK=true
fi
-if [[ "$USES_JAVA_SOURCE" == "true" ]]; then
- # We are compiling Java code, create it.
- mkdir -p src
- mkdir -p src2
- ${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src
- # Move build-src to src and the src copies to src2. This is needed because of
- # how our default build script works and we wanted the java and smali code
- # to be the same in the smali files.
- for f in `find ./build-src -type f -name "*.java" | xargs -i basename \{\}`; do
- mv ./src/$f ./src2/$f
- mv ./build-src/$f ./src/$f
- done
- # Ignore the smali directory.
- EXTRA_ARGS="--no-smali"
-fi
-
-./default-build "$@" "$EXTRA_ARGS" --experimental default-methods
+./default-build "$@" --experimental default-methods
diff --git a/test/965-default-verify/smali/Iface.smali b/test/965-default-verify/smali/Iface.smali
deleted file mode 100644
index 74799a6..0000000
--- a/test/965-default-verify/smali/Iface.smali
+++ /dev/null
@@ -1,40 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public interface Iface {
-# public default String sayHi() {
-# return "Hello";
-# }
-#
-# public default void verificationSoftFail() {
-# Statics.nonexistantFunction();
-# }
-# }
-
-.class public abstract interface LIface;
-.super Ljava/lang/Object;
-
-.method public sayHi()Ljava/lang/String;
- .locals 1
- const-string v0, "Hello"
- return-object v0
-.end method
-
-.method public verificationSoftFail()V
- .locals 1
- invoke-static {}, LStatics;->nonexistantFunction()V
- return-void
-.end method
diff --git a/test/965-default-verify/smali/Main.smali b/test/965-default-verify/smali/Main.smali
deleted file mode 100644
index 8e90706..0000000
--- a/test/965-default-verify/smali/Main.smali
+++ /dev/null
@@ -1,179 +0,0 @@
-# /*
-# * Copyright (C) 2015 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 Main implements Iface {
-# public static void main(String[] args) {
-# System.out.println("Create Main instance");
-# Main m = new Main();
-# System.out.println("Calling functions on concrete Main");
-# callMain(m);
-# System.out.println("Calling functions on interface Iface");
-# callIface(m);
-# }
-#
-# public static void callMain(Main m) {
-# System.out.println("Calling verifiable function on Main");
-# System.out.println(m.sayHi());
-# System.out.println("Calling unverifiable function on Main");
-# try {
-# m.verificationSoftFail();
-# System.out.println("Unexpected no error Thrown on Main");
-# } catch (NoSuchMethodError e) {
-# System.out.println("Expected NSME Thrown on Main");
-# } catch (Throwable e) {
-# System.out.println("Unexpected Error Thrown on Main");
-# e.printStackTrace(System.out);
-# }
-# System.out.println("Calling verifiable function on Main");
-# System.out.println(m.sayHi());
-# return;
-# }
-#
-# public static void callIface(Iface m) {
-# System.out.println("Calling verifiable function on Iface");
-# System.out.println(m.sayHi());
-# System.out.println("Calling unverifiable function on Iface");
-# try {
-# m.verificationSoftFail();
-# System.out.println("Unexpected no error Thrown on Iface");
-# } catch (NoSuchMethodError e) {
-# System.out.println("Expected NSME Thrown on Iface");
-# } catch (Throwable e) {
-# System.out.println("Unexpected Error Thrown on Iface");
-# e.printStackTrace(System.out);
-# }
-# System.out.println("Calling verifiable function on Iface");
-# System.out.println(m.sayHi());
-# return;
-# }
-# }
-
-.class public LMain;
-.super Ljava/lang/Object;
-.implements LIface;
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
-.method public static main([Ljava/lang/String;)V
- .locals 3
- sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
-
- const-string v0, "Create Main instance"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- new-instance v2, LMain;
- invoke-direct {v2}, LMain;-><init>()V
-
- const-string v0, "Calling functions on concrete Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- invoke-static {v2}, LMain;->callMain(LMain;)V
-
- const-string v0, "Calling functions on interface Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- invoke-static {v2}, LMain;->callIface(LIface;)V
-
- return-void
-.end method
-
-.method public static callIface(LIface;)V
- .locals 3
- sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
- const-string v0, "Calling verifiable function on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- invoke-interface {p0}, LIface;->sayHi()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- const-string v0, "Calling unverifiable function on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- :try_start
- invoke-interface {p0}, LIface;->verificationSoftFail()V
-
- const-string v0, "Unexpected no error Thrown on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- goto :error_end
- :try_end
- .catch Ljava/lang/NoSuchMethodError; {:try_start .. :try_end} :NSME_error_start
- .catch Ljava/lang/Throwable; {:try_start .. :try_end} :other_error_start
- :NSME_error_start
- const-string v0, "Expected NSME Thrown on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- goto :error_end
- :other_error_start
- move-exception v2
- const-string v0, "Unexpected Error Thrown on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- invoke-virtual {v2,v1}, Ljava/lang/Throwable;->printStackTrace(Ljava/io/PrintStream;)V
- goto :error_end
- :error_end
- const-string v0, "Calling verifiable function on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- invoke-interface {p0}, LIface;->sayHi()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- return-void
-.end method
-
-.method public static callMain(LMain;)V
- .locals 3
- sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
- const-string v0, "Calling verifiable function on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- invoke-virtual {p0}, LMain;->sayHi()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- const-string v0, "Calling unverifiable function on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- :try_start
- invoke-virtual {p0}, LMain;->verificationSoftFail()V
-
- const-string v0, "Unexpected no error Thrown on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- goto :error_end
- :try_end
- .catch Ljava/lang/NoSuchMethodError; {:try_start .. :try_end} :NSME_error_start
- .catch Ljava/lang/Throwable; {:try_start .. :try_end} :other_error_start
- :NSME_error_start
- const-string v0, "Expected NSME Thrown on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- goto :error_end
- :other_error_start
- move-exception v2
- const-string v0, "Unexpected Error Thrown on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- invoke-virtual {v2,v1}, Ljava/lang/Throwable;->printStackTrace(Ljava/io/PrintStream;)V
- goto :error_end
- :error_end
- const-string v0, "Calling verifiable function on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- invoke-virtual {p0}, LMain;->sayHi()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- return-void
-.end method
diff --git a/test/965-default-verify/smali/Statics.smali b/test/965-default-verify/smali/Statics.smali
deleted file mode 100644
index 1e8cac0..0000000
--- a/test/965-default-verify/smali/Statics.smali
+++ /dev/null
@@ -1,30 +0,0 @@
-# /*
-# * Copyright (C) 2015 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 Statics {
-# // public static void nonexistantFunction() {
-# // System.out.println("I don't exist");
-# // }
-# }
-#
-.class public LStatics;
-.super Ljava/lang/Object;
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
diff --git a/test/965-default-verify/build-src/Statics.java b/test/965-default-verify/src/Iface.java
similarity index 78%
copy from test/965-default-verify/build-src/Statics.java
copy to test/965-default-verify/src/Iface.java
index 300aeec..180fba2 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/965-default-verify/src/Iface.java
@@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public interface Iface {
+ public default String sayHi() {
+ return "Hello";
+ }
+ public default void verificationSoftFail() {
+ Statics.nonexistantFunction();
}
}
-
diff --git a/test/965-default-verify/src/Main.java b/test/965-default-verify/src/Main.java
new file mode 100644
index 0000000..6374cb5
--- /dev/null
+++ b/test/965-default-verify/src/Main.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2015 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 Main implements Iface {
+ public static void main(String[] args) {
+ System.out.println("Create Main instance");
+ Main m = new Main();
+ System.out.println("Calling functions on concrete Main");
+ callMain(m);
+ System.out.println("Calling functions on interface Iface");
+ callIface(m);
+ }
+
+ public static void callMain(Main m) {
+ System.out.println("Calling verifiable function on Main");
+ System.out.println(m.sayHi());
+ System.out.println("Calling unverifiable function on Main");
+ try {
+ m.verificationSoftFail();
+ System.out.println("Unexpected no error Thrown on Main");
+ } catch (NoSuchMethodError e) {
+ System.out.println("Expected NSME Thrown on Main");
+ } catch (Throwable e) {
+ System.out.println("Unexpected Error Thrown on Main");
+ e.printStackTrace(System.out);
+ }
+ System.out.println("Calling verifiable function on Main");
+ System.out.println(m.sayHi());
+ return;
+ }
+
+ public static void callIface(Iface m) {
+ System.out.println("Calling verifiable function on Iface");
+ System.out.println(m.sayHi());
+ System.out.println("Calling unverifiable function on Iface");
+ try {
+ m.verificationSoftFail();
+ System.out.println("Unexpected no error Thrown on Iface");
+ } catch (NoSuchMethodError e) {
+ System.out.println("Expected NSME Thrown on Iface");
+ } catch (Throwable e) {
+ System.out.println("Unexpected Error Thrown on Iface");
+ e.printStackTrace(System.out);
+ }
+ System.out.println("Calling verifiable function on Iface");
+ System.out.println(m.sayHi());
+ return;
+ }
+}
diff --git a/test/965-default-verify/build-src/Statics.java b/test/965-default-verify/src/Statics.java
similarity index 93%
rename from test/965-default-verify/build-src/Statics.java
rename to test/965-default-verify/src/Statics.java
index 300aeec..2e17ba4 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/965-default-verify/src/Statics.java
@@ -16,7 +16,7 @@
class Statics {
public static void nonexistantFunction() {
- System.out.println("I don't exist");
+ System.out.println("I don't exist");
}
}
diff --git a/test/965-default-verify/build-src/Statics.java b/test/965-default-verify/src2/Statics.java
similarity index 86%
copy from test/965-default-verify/build-src/Statics.java
copy to test/965-default-verify/src2/Statics.java
index 300aeec..7899ca9 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/965-default-verify/src2/Statics.java
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
- }
+ // public static void nonexistantFunction() {
+ // System.out.println("I don't exist");
+ // }
}
-
diff --git a/test/966-default-conflict/build b/test/966-default-conflict/build
index e66e840..0dd8573 100755
--- a/test/966-default-conflict/build
+++ b/test/966-default-conflict/build
@@ -17,18 +17,11 @@
# make us exit on a failure
set -e
-# TODO: Support running with jack.
-
-if [[ $@ == *"--jvm"* ]]; then
- # Build the Java files if we are running a --jvm test
- mkdir -p src
- mkdir -p classes
- ${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src
- # Build with the non-conflicting version
- ${JAVAC} -implicit:none -d classes src/Iface.java build-src/Iface2.java src/Main.java
- rm classes/Iface2.class
- # Build with the conflicting version
- ${JAVAC} -implicit:none -cp classes -d classes src/Iface2.java
-else
- ./default-build "$@" --experimental default-methods
+if [[ $@ != *"--jvm"* ]]; then
+ # Don't do anything with jvm
+ # Hard-wired use of experimental jack.
+ # TODO: fix this temporary work-around for default-methods, see b/19467889
+ export USE_JACK=true
fi
+
+./default-build "$@" --experimental default-methods
diff --git a/test/966-default-conflict/smali/Iface.smali b/test/966-default-conflict/smali/Iface.smali
deleted file mode 100644
index e996b3a..0000000
--- a/test/966-default-conflict/smali/Iface.smali
+++ /dev/null
@@ -1,39 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public interface Iface {
-# public default String sayHi() {
-# return "Hi";
-# }
-# public default String charge() {
-# return "CHARGE";
-# }
-# }
-
-.class public abstract interface LIface;
-.super Ljava/lang/Object;
-
-.method public sayHi()Ljava/lang/String;
- .locals 1
- const-string v0, "Hi"
- return-object v0
-.end method
-
-.method public charge()Ljava/lang/String;
- .locals 1
- const-string v0, "CHARGE"
- return-object v0
-.end method
diff --git a/test/966-default-conflict/smali/Iface2.smali b/test/966-default-conflict/smali/Iface2.smali
deleted file mode 100644
index 82fa547..0000000
--- a/test/966-default-conflict/smali/Iface2.smali
+++ /dev/null
@@ -1,31 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public interface Iface2 {
-# public default String sayHi() {
-# return "hello";
-# }
-# }
-
-.class public abstract interface LIface2;
-.super Ljava/lang/Object;
-
-.method public sayHi()Ljava/lang/String;
- .locals 1
- const-string v0, "hello"
- return-object v0
-.end method
-
diff --git a/test/966-default-conflict/smali/Main.smali b/test/966-default-conflict/smali/Main.smali
deleted file mode 100644
index ce974d8..0000000
--- a/test/966-default-conflict/smali/Main.smali
+++ /dev/null
@@ -1,227 +0,0 @@
-# /*
-# * Copyright (C) 2015 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 Main implements Iface, Iface2 {
-# public static void main(String[] args) {
-# System.out.println("Create Main instance");
-# Main m = new Main();
-# System.out.println("Calling functions on concrete Main");
-# callMain(m);
-# System.out.println("Calling functions on interface Iface");
-# callIface(m);
-# System.out.println("Calling functions on interface Iface2");
-# callIface2(m);
-# }
-#
-# public static void callMain(Main m) {
-# System.out.println("Calling non-conflicting function on Main");
-# System.out.println(m.charge());
-# System.out.println("Calling conflicting function on Main");
-# try {
-# System.out.println(m.sayHi());
-# System.out.println("Unexpected no error Thrown on Main");
-# } catch (AbstractMethodError e) {
-# System.out.println("Unexpected AME Thrown on Main");
-# } catch (IncompatibleClassChangeError e) {
-# System.out.println("Expected ICCE Thrown on Main");
-# }
-# System.out.println("Calling non-conflicting function on Main");
-# System.out.println(m.charge());
-# return;
-# }
-#
-# public static void callIface(Iface m) {
-# System.out.println("Calling non-conflicting function on Iface");
-# System.out.println(m.charge());
-# System.out.println("Calling conflicting function on Iface");
-# try {
-# System.out.println(m.sayHi());
-# System.out.println("Unexpected no error Thrown on Iface");
-# } catch (AbstractMethodError e) {
-# System.out.println("Unexpected AME Thrown on Iface");
-# } catch (IncompatibleClassChangeError e) {
-# System.out.println("Expected ICCE Thrown on Iface");
-# }
-# System.out.println("Calling non-conflicting function on Iface");
-# System.out.println(m.charge());
-# return;
-# }
-#
-# public static void callIface2(Iface2 m) {
-# System.out.println("Calling conflicting function on Iface2");
-# try {
-# System.out.println(m.sayHi());
-# System.out.println("Unexpected no error Thrown on Iface2");
-# } catch (AbstractMethodError e) {
-# System.out.println("Unexpected AME Thrown on Iface2");
-# } catch (IncompatibleClassChangeError e) {
-# System.out.println("Expected ICCE Thrown on Iface2");
-# }
-# return;
-# }
-# }
-
-.class public LMain;
-.super Ljava/lang/Object;
-.implements LIface;
-.implements LIface2;
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
-.method public static main([Ljava/lang/String;)V
- .locals 3
- sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
-
- const-string v0, "Create Main instance"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- new-instance v2, LMain;
- invoke-direct {v2}, LMain;-><init>()V
-
- const-string v0, "Calling functions on concrete Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- invoke-static {v2}, LMain;->callMain(LMain;)V
-
- const-string v0, "Calling functions on interface Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- invoke-static {v2}, LMain;->callIface(LIface;)V
-
- const-string v0, "Calling functions on interface Iface2"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- invoke-static {v2}, LMain;->callIface2(LIface2;)V
-
- return-void
-.end method
-
-.method public static callIface(LIface;)V
- .locals 2
- sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
- const-string v0, "Calling non-conflicting function on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- invoke-interface {p0}, LIface;->charge()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- const-string v0, "Calling conflicting function on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- :try_start
- invoke-interface {p0}, LIface;->sayHi()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- const-string v0, "Unexpected no error Thrown on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- goto :error_end
- :try_end
- .catch Ljava/lang/AbstractMethodError; {:try_start .. :try_end} :AME_error_start
- .catch Ljava/lang/IncompatibleClassChangeError; {:try_start .. :try_end} :ICCE_error_start
- :AME_error_start
- const-string v0, "Unexpected AME Thrown on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- goto :error_end
- :ICCE_error_start
- const-string v0, "Expected ICCE Thrown on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- goto :error_end
- :error_end
- const-string v0, "Calling non-conflicting function on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- invoke-interface {p0}, LIface;->charge()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- return-void
-.end method
-
-.method public static callIface2(LIface2;)V
- .locals 2
- sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
- const-string v0, "Calling conflicting function on Iface2"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- :try_start
- invoke-interface {p0}, LIface2;->sayHi()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- const-string v0, "Unexpected no error Thrown on Iface2"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- goto :error_end
- :try_end
- .catch Ljava/lang/AbstractMethodError; {:try_start .. :try_end} :AME_error_start
- .catch Ljava/lang/IncompatibleClassChangeError; {:try_start .. :try_end} :ICCE_error_start
- :AME_error_start
- const-string v0, "Unexpected AME Thrown on Iface2"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- goto :error_end
- :ICCE_error_start
- const-string v0, "Expected ICCE Thrown on Iface2"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- goto :error_end
- :error_end
-
- return-void
-.end method
-
-.method public static callMain(LMain;)V
- .locals 2
- sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
- const-string v0, "Calling non-conflicting function on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- invoke-virtual {p0}, LMain;->charge()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- const-string v0, "Calling conflicting function on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- :try_start
- invoke-virtual {p0}, LMain;->sayHi()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- const-string v0, "Unexpected no error Thrown on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- goto :error_end
- :try_end
- .catch Ljava/lang/AbstractMethodError; {:try_start .. :try_end} :AME_error_start
- .catch Ljava/lang/IncompatibleClassChangeError; {:try_start .. :try_end} :ICCE_error_start
- :AME_error_start
- const-string v0, "Unexpected AME Thrown on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- goto :error_end
- :ICCE_error_start
- const-string v0, "Expected ICCE Thrown on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- goto :error_end
- :error_end
- const-string v0, "Calling non-conflicting function on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- invoke-virtual {p0}, LMain;->charge()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- return-void
-.end method
diff --git a/test/965-default-verify/build-src/Statics.java b/test/966-default-conflict/src/Iface.java
similarity index 81%
copy from test/965-default-verify/build-src/Statics.java
copy to test/966-default-conflict/src/Iface.java
index 300aeec..2131ed8 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/966-default-conflict/src/Iface.java
@@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public interface Iface {
+ public default String sayHi() {
+ return "Hi";
+ }
+ public default String charge() {
+ return "CHARGE";
}
}
-
diff --git a/test/966-default-conflict/build-src/Iface2.java b/test/966-default-conflict/src/Iface2.java
similarity index 100%
rename from test/966-default-conflict/build-src/Iface2.java
rename to test/966-default-conflict/src/Iface2.java
diff --git a/test/966-default-conflict/src/Main.java b/test/966-default-conflict/src/Main.java
new file mode 100644
index 0000000..ce8cb47
--- /dev/null
+++ b/test/966-default-conflict/src/Main.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2015 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 Main implements Iface, Iface2 {
+ public static void main(String[] args) {
+ System.out.println("Create Main instance");
+ Main m = new Main();
+ System.out.println("Calling functions on concrete Main");
+ callMain(m);
+ System.out.println("Calling functions on interface Iface");
+ callIface(m);
+ System.out.println("Calling functions on interface Iface2");
+ callIface2(m);
+ }
+ public static void callMain(Main m) {
+ System.out.println("Calling non-conflicting function on Main");
+ System.out.println(m.charge());
+ System.out.println("Calling conflicting function on Main");
+ try {
+ System.out.println(m.sayHi());
+ System.out.println("Unexpected no error Thrown on Main");
+ } catch (AbstractMethodError e) {
+ System.out.println("Unexpected AME Thrown on Main");
+ } catch (IncompatibleClassChangeError e) {
+ System.out.println("Expected ICCE Thrown on Main");
+ }
+ System.out.println("Calling non-conflicting function on Main");
+ System.out.println(m.charge());
+ return;
+ }
+ public static void callIface(Iface m) {
+ System.out.println("Calling non-conflicting function on Iface");
+ System.out.println(m.charge());
+ System.out.println("Calling conflicting function on Iface");
+ try {
+ System.out.println(m.sayHi());
+ System.out.println("Unexpected no error Thrown on Iface");
+ } catch (AbstractMethodError e) {
+ System.out.println("Unexpected AME Thrown on Iface");
+ } catch (IncompatibleClassChangeError e) {
+ System.out.println("Expected ICCE Thrown on Iface");
+ }
+ System.out.println("Calling non-conflicting function on Iface");
+ System.out.println(m.charge());
+ return;
+ }
+ public static void callIface2(Iface2 m) {
+ System.out.println("Calling conflicting function on Iface2");
+ try {
+ System.out.println(m.sayHi());
+ System.out.println("Unexpected no error Thrown on Iface2");
+ } catch (AbstractMethodError e) {
+ System.out.println("Unexpected AME Thrown on Iface2");
+ } catch (IncompatibleClassChangeError e) {
+ System.out.println("Expected ICCE Thrown on Iface2");
+ }
+ return;
+ }
+}
diff --git a/test/965-default-verify/build-src/Statics.java b/test/966-default-conflict/src2/Iface2.java
similarity index 84%
copy from test/965-default-verify/build-src/Statics.java
copy to test/966-default-conflict/src2/Iface2.java
index 300aeec..d29033c 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/966-default-conflict/src2/Iface2.java
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public interface Iface2 {
+ public default String sayHi() {
+ return "hello";
}
}
-
diff --git a/test/967-default-ame/build b/test/967-default-ame/build
index 53001a9..0dd8573 100755
--- a/test/967-default-ame/build
+++ b/test/967-default-ame/build
@@ -17,19 +17,11 @@
# make us exit on a failure
set -e
-# TODO: Support running with jack.
-
-if [[ $@ == *"--jvm"* ]]; then
- # Build the Java files if we are running a --jvm test
- mkdir -p src
- mkdir -p classes
- ${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src
- # Build with the non-conflicting version
- ${JAVAC} -implicit:none -d classes src/Iface.java build-src/Iface2.java build-src/Iface3.java src/Main.java
- rm classes/Iface2.class
- rm classes/Iface3.class
- # Build with the conflicting version
- ${JAVAC} -implicit:none -cp classes -d classes src/Iface2.java src/Iface3.java
-else
- ./default-build "$@" --experimental default-methods
+if [[ $@ != *"--jvm"* ]]; then
+ # Don't do anything with jvm
+ # Hard-wired use of experimental jack.
+ # TODO: fix this temporary work-around for default-methods, see b/19467889
+ export USE_JACK=true
fi
+
+./default-build "$@" --experimental default-methods
diff --git a/test/967-default-ame/smali/Iface.smali b/test/967-default-ame/smali/Iface.smali
deleted file mode 100644
index e996b3a..0000000
--- a/test/967-default-ame/smali/Iface.smali
+++ /dev/null
@@ -1,39 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public interface Iface {
-# public default String sayHi() {
-# return "Hi";
-# }
-# public default String charge() {
-# return "CHARGE";
-# }
-# }
-
-.class public abstract interface LIface;
-.super Ljava/lang/Object;
-
-.method public sayHi()Ljava/lang/String;
- .locals 1
- const-string v0, "Hi"
- return-object v0
-.end method
-
-.method public charge()Ljava/lang/String;
- .locals 1
- const-string v0, "CHARGE"
- return-object v0
-.end method
diff --git a/test/967-default-ame/smali/Iface2.smali b/test/967-default-ame/smali/Iface2.smali
deleted file mode 100644
index a21a8dd..0000000
--- a/test/967-default-ame/smali/Iface2.smali
+++ /dev/null
@@ -1,27 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public interface Iface2 extends Iface {
-# public String sayHi();
-# }
-
-.class public abstract interface LIface2;
-.super Ljava/lang/Object;
-.implements LIface;
-
-.method public abstract sayHi()Ljava/lang/String;
-.end method
-
diff --git a/test/967-default-ame/smali/Iface3.smali b/test/967-default-ame/smali/Iface3.smali
deleted file mode 100644
index 874e96d..0000000
--- a/test/967-default-ame/smali/Iface3.smali
+++ /dev/null
@@ -1,26 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public interface Iface3 {
-# public String charge();
-# }
-
-.class public abstract interface LIface3;
-.super Ljava/lang/Object;
-
-.method public abstract charge()Ljava/lang/String;
-.end method
-
diff --git a/test/967-default-ame/smali/Main.smali b/test/967-default-ame/smali/Main.smali
deleted file mode 100644
index e4d63cf..0000000
--- a/test/967-default-ame/smali/Main.smali
+++ /dev/null
@@ -1,228 +0,0 @@
-# /*
-# * Copyright (C) 2015 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 Main implements Iface, Iface2, Iface3 {
-# public static void main(String[] args) {
-# System.out.println("Create Main instance");
-# Main m = new Main();
-# System.out.println("Calling functions on concrete Main");
-# callMain(m);
-# System.out.println("Calling functions on interface Iface");
-# callIface(m);
-# System.out.println("Calling functions on interface Iface2");
-# callIface2(m);
-# }
-#
-# public static void callMain(Main m) {
-# System.out.println("Calling non-abstract function on Main");
-# System.out.println(m.charge());
-# System.out.println("Calling abstract function on Main");
-# try {
-# System.out.println(m.sayHi());
-# System.out.println("Unexpected no error Thrown on Main");
-# } catch (AbstractMethodError e) {
-# System.out.println("Expected AME Thrown on Main");
-# } catch (IncompatibleClassChangeError e) {
-# System.out.println("Unexpected ICCE Thrown on Main");
-# }
-# System.out.println("Calling non-abstract function on Main");
-# System.out.println(m.charge());
-# return;
-# }
-#
-# public static void callIface(Iface m) {
-# System.out.println("Calling non-abstract function on Iface");
-# System.out.println(m.charge());
-# System.out.println("Calling abstract function on Iface");
-# try {
-# System.out.println(m.sayHi());
-# System.out.println("Unexpected no error Thrown on Iface");
-# } catch (AbstractMethodError e) {
-# System.out.println("Expected AME Thrown on Iface");
-# } catch (IncompatibleClassChangeError e) {
-# System.out.println("Unexpected ICCE Thrown on Iface");
-# }
-# System.out.println("Calling non-abstract function on Iface");
-# System.out.println(m.charge());
-# return;
-# }
-#
-# public static void callIface2(Iface2 m) {
-# System.out.println("Calling abstract function on Iface2");
-# try {
-# System.out.println(m.sayHi());
-# System.out.println("Unexpected no error Thrown on Iface2");
-# } catch (AbstractMethodError e) {
-# System.out.println("Expected AME Thrown on Iface2");
-# } catch (IncompatibleClassChangeError e) {
-# System.out.println("Unexpected ICCE Thrown on Iface2");
-# }
-# return;
-# }
-# }
-
-.class public LMain;
-.super Ljava/lang/Object;
-.implements LIface;
-.implements LIface2;
-.implements LIface3;
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
-.method public static main([Ljava/lang/String;)V
- .locals 3
- sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
-
- const-string v0, "Create Main instance"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- new-instance v2, LMain;
- invoke-direct {v2}, LMain;-><init>()V
-
- const-string v0, "Calling functions on concrete Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- invoke-static {v2}, LMain;->callMain(LMain;)V
-
- const-string v0, "Calling functions on interface Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- invoke-static {v2}, LMain;->callIface(LIface;)V
-
- const-string v0, "Calling functions on interface Iface2"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- invoke-static {v2}, LMain;->callIface2(LIface2;)V
-
- return-void
-.end method
-
-.method public static callIface(LIface;)V
- .locals 2
- sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
- const-string v0, "Calling non-abstract function on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- invoke-interface {p0}, LIface;->charge()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- const-string v0, "Calling abstract function on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- :try_start
- invoke-interface {p0}, LIface;->sayHi()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- const-string v0, "Unexpected no error Thrown on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- goto :error_end
- :try_end
- .catch Ljava/lang/AbstractMethodError; {:try_start .. :try_end} :AME_error_start
- .catch Ljava/lang/IncompatibleClassChangeError; {:try_start .. :try_end} :ICCE_error_start
- :AME_error_start
- const-string v0, "Expected AME Thrown on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- goto :error_end
- :ICCE_error_start
- const-string v0, "Unexpected ICCE Thrown on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- goto :error_end
- :error_end
- const-string v0, "Calling non-abstract function on Iface"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- invoke-interface {p0}, LIface;->charge()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- return-void
-.end method
-
-.method public static callIface2(LIface2;)V
- .locals 2
- sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
- const-string v0, "Calling abstract function on Iface2"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- :try_start
- invoke-interface {p0}, LIface2;->sayHi()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- const-string v0, "Unexpected no error Thrown on Iface2"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- goto :error_end
- :try_end
- .catch Ljava/lang/AbstractMethodError; {:try_start .. :try_end} :AME_error_start
- .catch Ljava/lang/IncompatibleClassChangeError; {:try_start .. :try_end} :ICCE_error_start
- :AME_error_start
- const-string v0, "Expected AME Thrown on Iface2"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- goto :error_end
- :ICCE_error_start
- const-string v0, "Unexpected ICCE Thrown on Iface2"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- goto :error_end
- :error_end
-
- return-void
-.end method
-
-.method public static callMain(LMain;)V
- .locals 2
- sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
- const-string v0, "Calling non-abstract function on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- invoke-virtual {p0}, LMain;->charge()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- const-string v0, "Calling abstract function on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- :try_start
- invoke-virtual {p0}, LMain;->sayHi()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- const-string v0, "Unexpected no error Thrown on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- goto :error_end
- :try_end
- .catch Ljava/lang/AbstractMethodError; {:try_start .. :try_end} :AME_error_start
- .catch Ljava/lang/IncompatibleClassChangeError; {:try_start .. :try_end} :ICCE_error_start
- :AME_error_start
- const-string v0, "Expected AME Thrown on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- goto :error_end
- :ICCE_error_start
- const-string v0, "Unexpected ICCE Thrown on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- goto :error_end
- :error_end
- const-string v0, "Calling non-abstract function on Main"
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- invoke-virtual {p0}, LMain;->charge()Ljava/lang/String;
- move-result-object v0
- invoke-virtual {v1,v0}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- return-void
-.end method
diff --git a/test/965-default-verify/build-src/Statics.java b/test/967-default-ame/src/Iface.java
similarity index 81%
copy from test/965-default-verify/build-src/Statics.java
copy to test/967-default-ame/src/Iface.java
index 300aeec..2131ed8 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/967-default-ame/src/Iface.java
@@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public interface Iface {
+ public default String sayHi() {
+ return "Hi";
+ }
+ public default String charge() {
+ return "CHARGE";
}
}
-
diff --git a/test/967-default-ame/build-src/Iface2.java b/test/967-default-ame/src/Iface2.java
similarity index 100%
rename from test/967-default-ame/build-src/Iface2.java
rename to test/967-default-ame/src/Iface2.java
diff --git a/test/967-default-ame/build-src/Iface3.java b/test/967-default-ame/src/Iface3.java
similarity index 100%
rename from test/967-default-ame/build-src/Iface3.java
rename to test/967-default-ame/src/Iface3.java
diff --git a/test/967-default-ame/src/Main.java b/test/967-default-ame/src/Main.java
new file mode 100644
index 0000000..3e48062
--- /dev/null
+++ b/test/967-default-ame/src/Main.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2015 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 Main implements Iface, Iface2, Iface3 {
+ public static void main(String[] args) {
+ System.out.println("Create Main instance");
+ Main m = new Main();
+ System.out.println("Calling functions on concrete Main");
+ callMain(m);
+ System.out.println("Calling functions on interface Iface");
+ callIface(m);
+ System.out.println("Calling functions on interface Iface2");
+ callIface2(m);
+ }
+ public static void callMain(Main m) {
+ System.out.println("Calling non-abstract function on Main");
+ System.out.println(m.charge());
+ System.out.println("Calling abstract function on Main");
+ try {
+ System.out.println(m.sayHi());
+ System.out.println("Unexpected no error Thrown on Main");
+ } catch (AbstractMethodError e) {
+ System.out.println("Expected AME Thrown on Main");
+ } catch (IncompatibleClassChangeError e) {
+ System.out.println("Unexpected ICCE Thrown on Main");
+ }
+ System.out.println("Calling non-abstract function on Main");
+ System.out.println(m.charge());
+ return;
+ }
+ public static void callIface(Iface m) {
+ System.out.println("Calling non-abstract function on Iface");
+ System.out.println(m.charge());
+ System.out.println("Calling abstract function on Iface");
+ try {
+ System.out.println(m.sayHi());
+ System.out.println("Unexpected no error Thrown on Iface");
+ } catch (AbstractMethodError e) {
+ System.out.println("Expected AME Thrown on Iface");
+ } catch (IncompatibleClassChangeError e) {
+ System.out.println("Unexpected ICCE Thrown on Iface");
+ }
+ System.out.println("Calling non-abstract function on Iface");
+ System.out.println(m.charge());
+ return;
+ }
+ public static void callIface2(Iface2 m) {
+ System.out.println("Calling abstract function on Iface2");
+ try {
+ System.out.println(m.sayHi());
+ System.out.println("Unexpected no error Thrown on Iface2");
+ } catch (AbstractMethodError e) {
+ System.out.println("Expected AME Thrown on Iface2");
+ } catch (IncompatibleClassChangeError e) {
+ System.out.println("Unexpected ICCE Thrown on Iface2");
+ }
+ return;
+ }
+}
diff --git a/test/965-default-verify/build-src/Statics.java b/test/967-default-ame/src2/Iface.java
similarity index 81%
copy from test/965-default-verify/build-src/Statics.java
copy to test/967-default-ame/src2/Iface.java
index 300aeec..2131ed8 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/967-default-ame/src2/Iface.java
@@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public interface Iface {
+ public default String sayHi() {
+ return "Hi";
+ }
+ public default String charge() {
+ return "CHARGE";
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/967-default-ame/src2/Iface2.java
similarity index 84%
copy from test/965-default-verify/build-src/Statics.java
copy to test/967-default-ame/src2/Iface2.java
index 300aeec..0e4fb5f 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/967-default-ame/src2/Iface2.java
@@ -13,10 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
- }
+public interface Iface2 extends Iface {
+ public String sayHi();
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/967-default-ame/src2/Iface3.java
similarity index 84%
copy from test/965-default-verify/build-src/Statics.java
copy to test/967-default-ame/src2/Iface3.java
index 300aeec..70fc33b 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/967-default-ame/src2/Iface3.java
@@ -13,10 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
- }
+public interface Iface3 {
+ public String charge();
}
-
diff --git a/test/969-iface-super/build b/test/969-iface-super/build
index b1ef320..e8f4ed0 100755
--- a/test/969-iface-super/build
+++ b/test/969-iface-super/build
@@ -17,27 +17,14 @@
# make us exit on a failure
set -e
-# Should we compile with Java source code. By default we will use Smali.
-USES_JAVA_SOURCE="false"
-if [[ $@ == *"--jvm"* ]]; then
- USES_JAVA_SOURCE="true"
-elif [[ "$USE_JACK" == "true" ]]; then
- if $JACK -D jack.java.source.version=1.8 2>/dev/null; then
- USES_JAVA_SOURCE="true"
- else
- echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2
- fi
+if [[ $@ != *"--jvm"* ]]; then
+ # Don't do anything with jvm
+ # Hard-wired use of experimental jack.
+ # TODO: fix this temporary work-around for default-methods, see b/19467889
+ export USE_JACK=true
fi
-# Generate the smali Main.smali file or fail
-${ANDROID_BUILD_TOP}/art/test/utils/python/generate_smali_main.py ./smali
+# Generate the Main.java file or fail
+${ANDROID_BUILD_TOP}/art/test/utils/python/generate_java_main.py ./src
-if [[ "$USES_JAVA_SOURCE" == "true" ]]; then
- # We are compiling java code, create it.
- mkdir -p src
- ${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src
- # Ignore the smali directory.
- EXTRA_ARGS="--no-smali"
-fi
-
-./default-build "$@" "$EXTRA_ARGS" --experimental default-methods
+./default-build "$@" --experimental default-methods
diff --git a/test/969-iface-super/expected.txt b/test/969-iface-super/expected.txt
index f310d10..f7a63d6 100644
--- a/test/969-iface-super/expected.txt
+++ b/test/969-iface-super/expected.txt
@@ -1,39 +1,39 @@
Testing for type A
A-virtual A.SayHi()='Hello '
-A-interface iface.SayHi()='Hello '
+A-interface Iface.SayHi()='Hello '
End testing for type A
Testing for type B
B-virtual B.SayHi()='Hello Hello '
-B-interface iface.SayHi()='Hello Hello '
-B-interface iface2.SayHi()='Hello Hello '
+B-interface Iface.SayHi()='Hello Hello '
+B-interface Iface2.SayHi()='Hello Hello '
End testing for type B
Testing for type C
C-virtual C.SayHi()='Hello and welcome '
-C-interface iface.SayHi()='Hello and welcome '
+C-interface Iface.SayHi()='Hello and welcome '
End testing for type C
Testing for type D
D-virtual D.SayHi()='Hello Hello and welcome '
-D-interface iface.SayHi()='Hello Hello and welcome '
-D-interface iface2.SayHi()='Hello Hello and welcome '
+D-interface Iface.SayHi()='Hello Hello and welcome '
+D-interface Iface2.SayHi()='Hello Hello and welcome '
End testing for type D
Testing for type E
E-virtual E.SayHi()='Hello there!'
-E-interface iface.SayHi()='Hello there!'
-E-interface iface3.SayHi()='Hello there!'
+E-interface Iface.SayHi()='Hello there!'
+E-interface Iface3.SayHi()='Hello there!'
End testing for type E
Testing for type F
F-virtual E.SayHi()='Hello there!'
F-virtual F.SayHi()='Hello there!'
-F-interface iface.SayHi()='Hello there!'
-F-interface iface3.SayHi()='Hello there!'
+F-interface Iface.SayHi()='Hello there!'
+F-interface Iface3.SayHi()='Hello there!'
F-virtual F.SaySurprisedHi()='Hello there!!'
End testing for type F
Testing for type G
G-virtual E.SayHi()='Hello there!?'
G-virtual F.SayHi()='Hello there!?'
G-virtual G.SayHi()='Hello there!?'
-G-interface iface.SayHi()='Hello there!?'
-G-interface iface3.SayHi()='Hello there!?'
+G-interface Iface.SayHi()='Hello there!?'
+G-interface Iface3.SayHi()='Hello there!?'
G-virtual F.SaySurprisedHi()='Hello there!!'
G-virtual G.SaySurprisedHi()='Hello there!!'
G-virtual G.SayVerySurprisedHi()='Hello there!!!'
@@ -42,6 +42,6 @@
H-virtual H.SayConfusedHi()='Hello ?!'
H-virtual A.SayHi()='Hello ?'
H-virtual H.SayHi()='Hello ?'
-H-interface iface.SayHi()='Hello ?'
+H-interface Iface.SayHi()='Hello ?'
H-virtual H.SaySurprisedHi()='Hello !'
End testing for type H
diff --git a/test/969-iface-super/smali/A.smali b/test/969-iface-super/smali/A.smali
deleted file mode 100644
index e7760a1..0000000
--- a/test/969-iface-super/smali/A.smali
+++ /dev/null
@@ -1,28 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public class A implements iface {
-# }
-
-.class public LA;
-.super Ljava/lang/Object;
-.implements Liface;
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
diff --git a/test/969-iface-super/smali/B.smali b/test/969-iface-super/smali/B.smali
deleted file mode 100644
index e529d05..0000000
--- a/test/969-iface-super/smali/B.smali
+++ /dev/null
@@ -1,28 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public class B implements iface2 {
-# }
-
-.class public LB;
-.super Ljava/lang/Object;
-.implements Liface2;
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
diff --git a/test/969-iface-super/smali/C.smali b/test/969-iface-super/smali/C.smali
deleted file mode 100644
index 6fbb0c4..0000000
--- a/test/969-iface-super/smali/C.smali
+++ /dev/null
@@ -1,41 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public class C implements iface {
-# public String SayHi() {
-# return iface.super.SayHi() + " and welcome ";
-# }
-# }
-
-.class public LC;
-.super Ljava/lang/Object;
-.implements Liface;
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
-.method public SayHi()Ljava/lang/String;
- .locals 2
- invoke-super {p0}, Liface;->SayHi()Ljava/lang/String;
- move-result-object v0
- const-string v1, " and welcome "
- invoke-virtual {v0, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- return-object v0
-.end method
diff --git a/test/969-iface-super/smali/D.smali b/test/969-iface-super/smali/D.smali
deleted file mode 100644
index ecd4629..0000000
--- a/test/969-iface-super/smali/D.smali
+++ /dev/null
@@ -1,41 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public class D implements iface2 {
-# public String SayHi() {
-# return iface2.super.SayHi() + " and welcome ";
-# }
-# }
-
-.class public LD;
-.super Ljava/lang/Object;
-.implements Liface2;
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
-.method public SayHi()Ljava/lang/String;
- .locals 2
- invoke-super {p0}, Liface2;->SayHi()Ljava/lang/String;
- move-result-object v0
- const-string v1, " and welcome "
- invoke-virtual {v0, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- return-object v0
-.end method
diff --git a/test/969-iface-super/smali/E.smali b/test/969-iface-super/smali/E.smali
deleted file mode 100644
index 558aaea..0000000
--- a/test/969-iface-super/smali/E.smali
+++ /dev/null
@@ -1,41 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public class E implements iface3 {
-# public String SayHi() {
-# return iface3.super.SayHi() + " there!";
-# }
-# }
-
-.class public LE;
-.super Ljava/lang/Object;
-.implements Liface3;
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
-.method public SayHi()Ljava/lang/String;
- .locals 2
- invoke-super {p0}, Liface3;->SayHi()Ljava/lang/String;
- move-result-object v0
- const-string v1, " there!"
- invoke-virtual {v0, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- return-object v0
-.end method
diff --git a/test/969-iface-super/smali/F.smali b/test/969-iface-super/smali/F.smali
deleted file mode 100644
index c402d5c..0000000
--- a/test/969-iface-super/smali/F.smali
+++ /dev/null
@@ -1,40 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public class F extends E {
-# public String SaySurprisedHi() {
-# return super.SayHi() + "!";
-# }
-# }
-
-.class public LF;
-.super LE;
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, LE;-><init>()V
- return-void
-.end method
-
-.method public SaySurprisedHi()Ljava/lang/String;
- .registers 2
- invoke-super {p0}, LE;->SayHi()Ljava/lang/String;
- move-result-object v0
- const-string v1, "!"
- invoke-virtual {v0, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- return-object v0
-.end method
diff --git a/test/969-iface-super/smali/G.smali b/test/969-iface-super/smali/G.smali
deleted file mode 100644
index 45705e6..0000000
--- a/test/969-iface-super/smali/G.smali
+++ /dev/null
@@ -1,53 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public class G extends F {
-# public String SayHi() {
-# return super.SayHi() + "?";
-# }
-# public String SayVerySurprisedHi() {
-# return super.SaySurprisedHi() + "!";
-# }
-# }
-
-.class public LG;
-.super LF;
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, LF;-><init>()V
- return-void
-.end method
-
-.method public SayHi()Ljava/lang/String;
- .locals 2
- invoke-super {p0}, LF;->SayHi()Ljava/lang/String;
- move-result-object v0
- const-string v1, "?"
- invoke-virtual {v0, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- return-object v0
-.end method
-
-.method public SayVerySurprisedHi()Ljava/lang/String;
- .locals 2
- invoke-super {p0}, LF;->SaySurprisedHi()Ljava/lang/String;
- move-result-object v0
- const-string v1, "!"
- invoke-virtual {v0, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- return-object v0
-.end method
diff --git a/test/969-iface-super/smali/H.smali b/test/969-iface-super/smali/H.smali
deleted file mode 100644
index 12f246b..0000000
--- a/test/969-iface-super/smali/H.smali
+++ /dev/null
@@ -1,66 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public class H extends A {
-# public String SayHi() {
-# return super.SayHi() + "?";
-# }
-# public String SaySurprisedHi() {
-# return super.SayHi() + "!";
-# }
-# public String SayConfusedHi() {
-# return SayHi() + "!";
-# }
-# }
-
-.class public LH;
-.super LA;
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {p0}, LA;-><init>()V
- return-void
-.end method
-
-.method public SayHi()Ljava/lang/String;
- .locals 2
- invoke-super {p0}, LA;->SayHi()Ljava/lang/String;
- move-result-object v0
- const-string v1, "?"
- invoke-virtual {v0, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- return-object v0
-.end method
-
-.method public SaySurprisedHi()Ljava/lang/String;
- .locals 2
- invoke-super {p0}, LA;->SayHi()Ljava/lang/String;
- move-result-object v0
- const-string v1, "!"
- invoke-virtual {v0, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- return-object v0
-.end method
-
-.method public SayConfusedHi()Ljava/lang/String;
- .locals 2
- invoke-virtual {p0}, LH;->SayHi()Ljava/lang/String;
- move-result-object v0
- const-string v1, "!"
- invoke-virtual {v0, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- return-object v0
-.end method
diff --git a/test/969-iface-super/smali/iface.smali b/test/969-iface-super/smali/iface.smali
deleted file mode 100644
index 08bb93d..0000000
--- a/test/969-iface-super/smali/iface.smali
+++ /dev/null
@@ -1,30 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public interface iface {
-# public default String SayHi() {
-# return "Hello ";
-# }
-# }
-
-.class public abstract interface Liface;
-.super Ljava/lang/Object;
-
-.method public SayHi()Ljava/lang/String;
- .locals 1
- const-string v0, "Hello "
- return-object v0
-.end method
diff --git a/test/969-iface-super/smali/iface2.smali b/test/969-iface-super/smali/iface2.smali
deleted file mode 100644
index ce6f864..0000000
--- a/test/969-iface-super/smali/iface2.smali
+++ /dev/null
@@ -1,36 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public interface iface2 extends iface {
-# public default String SayHi() {
-# return iface.super.SayHi() + iface.super.SayHi();
-# }
-# }
-
-.class public abstract interface Liface2;
-.super Ljava/lang/Object;
-.implements Liface;
-
-.method public SayHi()Ljava/lang/String;
- .locals 2
- invoke-super {p0}, Liface;->SayHi()Ljava/lang/String;
- move-result-object v0
- invoke-super {p0}, Liface;->SayHi()Ljava/lang/String;
- move-result-object v1
- invoke-virtual {v0, v1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- return-object v0
-.end method
diff --git a/test/969-iface-super/smali/iface3.smali b/test/969-iface-super/smali/iface3.smali
deleted file mode 100644
index bf20036..0000000
--- a/test/969-iface-super/smali/iface3.smali
+++ /dev/null
@@ -1,22 +0,0 @@
-# /*
-# * Copyright (C) 2015 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.
-# */
-#
-# public interface iface3 extends iface {
-# }
-
-.class public abstract interface Liface3;
-.super Ljava/lang/Object;
-.implements Liface;
diff --git a/test/965-default-verify/build-src/Statics.java b/test/969-iface-super/src/A.java
similarity index 84%
copy from test/965-default-verify/build-src/Statics.java
copy to test/969-iface-super/src/A.java
index 300aeec..47db14b 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/969-iface-super/src/A.java
@@ -13,10 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
- }
-}
-
+public class A implements Iface { }
diff --git a/test/965-default-verify/build-src/Statics.java b/test/969-iface-super/src/B.java
similarity index 84%
copy from test/965-default-verify/build-src/Statics.java
copy to test/969-iface-super/src/B.java
index 300aeec..70f63a2 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/969-iface-super/src/B.java
@@ -13,10 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
- }
-}
-
+public class B implements Iface2 { }
diff --git a/test/965-default-verify/build-src/Statics.java b/test/969-iface-super/src/C.java
similarity index 84%
copy from test/965-default-verify/build-src/Statics.java
copy to test/969-iface-super/src/C.java
index 300aeec..0fa0b92 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/969-iface-super/src/C.java
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public class C implements Iface {
+ public String SayHi() {
+ return Iface.super.SayHi() + " and welcome ";
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/969-iface-super/src/D.java
similarity index 84%
copy from test/965-default-verify/build-src/Statics.java
copy to test/969-iface-super/src/D.java
index 300aeec..8a607c3 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/969-iface-super/src/D.java
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public class D implements Iface2 {
+ public String SayHi() {
+ return Iface2.super.SayHi() + " and welcome ";
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/969-iface-super/src/E.java
similarity index 84%
copy from test/965-default-verify/build-src/Statics.java
copy to test/969-iface-super/src/E.java
index 300aeec..d5942b2 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/969-iface-super/src/E.java
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public class E implements Iface3 {
+ public String SayHi() {
+ return Iface3.super.SayHi() + " there!";
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/969-iface-super/src/F.java
similarity index 84%
copy from test/965-default-verify/build-src/Statics.java
copy to test/969-iface-super/src/F.java
index 300aeec..610bcb1 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/969-iface-super/src/F.java
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public class F extends E {
+ public String SaySurprisedHi() {
+ return super.SayHi() + "!";
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/969-iface-super/src/G.java
similarity index 78%
copy from test/965-default-verify/build-src/Statics.java
copy to test/969-iface-super/src/G.java
index 300aeec..edaf3a9 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/969-iface-super/src/G.java
@@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public class G extends F {
+ public String SayHi() {
+ return super.SayHi() + "?";
+ }
+ public String SayVerySurprisedHi() {
+ return super.SaySurprisedHi() + "!";
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/969-iface-super/src/H.java
similarity index 73%
copy from test/965-default-verify/build-src/Statics.java
copy to test/969-iface-super/src/H.java
index 300aeec..744bda6 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/969-iface-super/src/H.java
@@ -13,10 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public class H extends A {
+ public String SayHi() {
+ return super.SayHi() + "?";
+ }
+ public String SaySurprisedHi() {
+ return super.SayHi() + "!";
+ }
+ public String SayConfusedHi() {
+ return SayHi() + "!";
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/969-iface-super/src/Iface.java
similarity index 84%
copy from test/965-default-verify/build-src/Statics.java
copy to test/969-iface-super/src/Iface.java
index 300aeec..ece5e59 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/969-iface-super/src/Iface.java
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public interface Iface {
+ public default String SayHi() {
+ return "Hello ";
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/969-iface-super/src/Iface2.java
similarity index 82%
copy from test/965-default-verify/build-src/Statics.java
copy to test/969-iface-super/src/Iface2.java
index 300aeec..d74ee6d 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/969-iface-super/src/Iface2.java
@@ -13,10 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
+public interface Iface2 extends Iface {
+ public default String SayHi() {
+ return Iface.super.SayHi() + Iface.super.SayHi();
}
}
-
diff --git a/test/965-default-verify/build-src/Statics.java b/test/969-iface-super/src/Iface3.java
similarity index 84%
copy from test/965-default-verify/build-src/Statics.java
copy to test/969-iface-super/src/Iface3.java
index 300aeec..10b010c 100644
--- a/test/965-default-verify/build-src/Statics.java
+++ b/test/969-iface-super/src/Iface3.java
@@ -13,10 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-class Statics {
- public static void nonexistantFunction() {
- System.out.println("I don't exist");
- }
-}
-
+public interface Iface3 extends Iface { }
diff --git a/test/969-iface-super/smali/classes.xml b/test/969-iface-super/src/classes.xml
similarity index 85%
rename from test/969-iface-super/smali/classes.xml
rename to test/969-iface-super/src/classes.xml
index 4d205bd..4c3dae4 100644
--- a/test/969-iface-super/smali/classes.xml
+++ b/test/969-iface-super/src/classes.xml
@@ -18,35 +18,35 @@
<classes>
<class name="A" super="java/lang/Object">
<implements>
- <item>iface</item>
+ <item>Iface</item>
</implements>
<methods> </methods>
</class>
<class name="B" super="java/lang/Object">
<implements>
- <item>iface2</item>
+ <item>Iface2</item>
</implements>
<methods> </methods>
</class>
<class name="C" super="java/lang/Object">
<implements>
- <item>iface</item>
+ <item>Iface</item>
</implements>
<methods> </methods>
</class>
<class name="D" super="java/lang/Object">
<implements>
- <item>iface2</item>
+ <item>Iface2</item>
</implements>
<methods> </methods>
</class>
<class name="E" super="java/lang/Object">
<implements>
- <item>iface3</item>
+ <item>Iface3</item>
</implements>
<methods> </methods>
</class>
@@ -75,23 +75,23 @@
</classes>
<interfaces>
- <interface name="iface" super="java/lang/Object">
+ <interface name="Iface" super="java/lang/Object">
<implements> </implements>
<methods>
<item>SayHi</item>
</methods>
</interface>
- <interface name="iface2" super="java/lang/Object">
+ <interface name="Iface2" super="java/lang/Object">
<implements>
- <item>iface</item>
+ <item>Iface</item>
</implements>
<methods> </methods>
</interface>
- <interface name="iface3" super="java/lang/Object">
+ <interface name="Iface3" super="java/lang/Object">
<implements>
- <item>iface</item>
+ <item>Iface</item>
</implements>
<methods> </methods>
</interface>
diff --git a/test/utils/python/generate_smali_main.py b/test/utils/python/generate_java_main.py
similarity index 67%
rename from test/utils/python/generate_smali_main.py
rename to test/utils/python/generate_java_main.py
index d796d31..f66d0dd 100755
--- a/test/utils/python/generate_smali_main.py
+++ b/test/utils/python/generate_java_main.py
@@ -15,7 +15,7 @@
# limitations under the License.
"""
-Generate Smali Main file from a classes.xml file.
+Generate Java Main file from a classes.xml file.
"""
import os
@@ -38,48 +38,27 @@
import functools
import xml.etree.ElementTree as ET
-class MainClass(mixins.DumpMixin, mixins.Named, mixins.SmaliFileMixin):
+class MainClass(mixins.DumpMixin, mixins.Named, mixins.JavaFileMixin):
"""
A mainclass and main method for this test.
"""
MAIN_CLASS_TEMPLATE = """{copyright}
-.class public LMain;
-.super Ljava/lang/Object;
-
-# class Main {{
-
-.method public constructor <init>()V
- .registers 1
- invoke-direct {{p0}}, Ljava/lang/Object;-><init>()V
- return-void
-.end method
-
+class Main {{
{test_groups}
-
{test_funcs}
-
{main_func}
-
-# }}
+}}
"""
MAIN_FUNCTION_TEMPLATE = """
-# public static void main(String[] args) {{
-.method public static main([Ljava/lang/String;)V
- .locals 2
- sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
-
+ public static void main(String[] args) {{
{test_group_invoke}
-
- return-void
-.end method
-# }}
+ }}
"""
TEST_GROUP_INVOKE_TEMPLATE = """
-# {test_name}();
- invoke-static {{}}, {test_name}()V
+ {test_name}();
"""
def __init__(self):
@@ -123,7 +102,7 @@
funcs = ""
for f in self.global_funcs:
funcs += str(f)
- return self.MAIN_CLASS_TEMPLATE.format(copyright = get_copyright('smali'),
+ return self.MAIN_CLASS_TEMPLATE.format(copyright = get_copyright('java'),
test_groups=test_groups,
main_func=main_func, test_funcs=funcs)
@@ -135,33 +114,19 @@
"""
INSTANCE_TEST_TEMPLATE = """
-# public static void {test_name}() {{
-# System.out.println("Testing for type {ty}");
-# String s = "{ty}";
-# {ty} v = new {ty}();
-.method public static {test_name}()V
- .locals 3
- sget-object v2, Ljava/lang/System;->out:Ljava/io/PrintStream;
- const-string v0, "Testing for type {ty}"
- invoke-virtual {{v2,v0}}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
-
- const-string v0, "{ty}"
- new-instance v1, L{ty};
- invoke-direct {{v1}}, L{ty};-><init>()V
+ public static void {test_name}() {{
+ System.out.println("Testing for type {ty}");
+ String s = "{ty}";
+ {ty} v = new {ty}();
{invokes}
- const-string v0, "End testing for type {ty}"
- invoke-virtual {{v2,v0}}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V
- return-void
-.end method
-# System.out.println("End testing for type {ty}");
-# }}
+ System.out.println("End testing for type {ty}");
+ }}
"""
TEST_INVOKE_TEMPLATE = """
-# {fname}(s, v);
- invoke-static {{v0, v1}}, {fname}(Ljava/lang/String;L{farg};)V
+ {fname}(s, v);
"""
def __init__(self, main, ty):
@@ -188,7 +153,7 @@
def __str__(self):
"""
- Returns the smali code for this function
+ Returns the java code for this function
"""
func_invokes = ""
for f in sorted(self.funcs, key=lambda a: (a.func, a.farg)):
@@ -204,47 +169,15 @@
"""
TEST_FUNCTION_TEMPLATE = """
-# public static void {fname}(String s, {farg} v) {{
-# try {{
-# System.out.printf("%s-{invoke_type:<9} {farg:>9}.{callfunc}()='%s'\\n", s, v.{callfunc}());
-# return;
-# }} catch (Error e) {{
-# System.out.printf("%s-{invoke_type} on {farg}: {callfunc}() threw exception!\\n", s);
-# e.printStackTrace(System.out);
-# }}
-# }}
-.method public static {fname}(Ljava/lang/String;L{farg};)V
- .locals 7
- :call_{fname}_try_start
- const/4 v0, 2
- new-array v1,v0, [Ljava/lang/Object;
- const/4 v0, 0
- aput-object p0,v1,v0
-
- sget-object v2, Ljava/lang/System;->out:Ljava/io/PrintStream;
- const-string v3, "%s-{invoke_type:<9} {farg:>9}.{callfunc}()='%s'\\n"
-
- invoke-{invoke_type} {{p1}}, L{farg};->{callfunc}()Ljava/lang/String;
- move-result-object v4
- const/4 v0, 1
- aput-object v4, v1, v0
-
- invoke-virtual {{v2,v3,v1}}, Ljava/io/PrintStream;->printf(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;
- return-void
- :call_{fname}_try_end
- .catch Ljava/lang/Error; {{:call_{fname}_try_start .. :call_{fname}_try_end}} :error_{fname}_start
- :error_{fname}_start
- move-exception v3
- const/4 v0, 1
- new-array v1,v0, [Ljava/lang/Object;
- const/4 v0, 0
- aput-object p0, v1, v0
- sget-object v2, Ljava/lang/System;->out:Ljava/io/PrintStream;
- const-string v4, "%s-{invoke_type} on {farg}: {callfunc}() threw exception!\\n"
- invoke-virtual {{v2,v4,v1}}, Ljava/io/PrintStream;->printf(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;
- invoke-virtual {{v3,v2}}, Ljava/lang/Error;->printStackTrace(Ljava/io/PrintStream;)V
- return-void
-.end method
+ public static void {fname}(String s, {farg} v) {{
+ try {{
+ System.out.printf("%s-{invoke_type:<9} {farg:>9}.{callfunc}()='%s'\\n", s, v.{callfunc}());
+ return;
+ }} catch (Error e) {{
+ System.out.printf("%s-{invoke_type} on {farg}: {callfunc}() threw exception!\\n", s);
+ e.printStackTrace(System.out);
+ }}
+ }}
"""
def __init__(self, func, farg, invoke):
@@ -263,7 +196,7 @@
def __str__(self):
"""
- Get the smali code for this test function
+ Get the java code for this test function
"""
return self.TEST_FUNCTION_TEMPLATE.format(fname=self.get_name(),
farg=self.farg,
@@ -307,7 +240,7 @@
def make_main_class(dat):
"""
- Creates a Main.smali file that runs all the tests
+ Creates a Main.java file that runs all the tests
"""
m = MainClass()
for c in dat.classes.values():
@@ -365,12 +298,12 @@
return TestData(classes, ifaces)
def main(argv):
- smali_dir = Path(argv[1])
- if not smali_dir.exists() or not smali_dir.is_dir():
- print("{} is not a valid smali dir".format(smali_dir), file=sys.stderr)
+ java_dir = Path(argv[1])
+ if not java_dir.exists() or not java_dir.is_dir():
+ print("{} is not a valid java dir".format(java_dir), file=sys.stderr)
sys.exit(1)
- class_data = parse_xml((smali_dir / "classes.xml").open().read())
- make_main_class(class_data).dump(smali_dir)
+ class_data = parse_xml((java_dir / "classes.xml").open().read())
+ make_main_class(class_data).dump(java_dir)
if __name__ == '__main__':
main(sys.argv)