diff options
Diffstat (limited to 'test/068-classloader/src-ex')
-rw-r--r-- | test/068-classloader/src-ex/AbstractGet.java | 32 | ||||
-rw-r--r-- | test/068-classloader/src-ex/DoubledExtend.java | 20 | ||||
-rw-r--r-- | test/068-classloader/src-ex/DoubledExtendOkay.java | 36 | ||||
-rw-r--r-- | test/068-classloader/src-ex/DoubledImplement.java | 18 | ||||
-rw-r--r-- | test/068-classloader/src-ex/DoubledImplement2.java | 32 | ||||
-rw-r--r-- | test/068-classloader/src-ex/GetDoubled.java | 26 | ||||
-rw-r--r-- | test/068-classloader/src-ex/IfaceImpl.java | 21 | ||||
-rw-r--r-- | test/068-classloader/src-ex/IfaceSub.java | 19 | ||||
-rw-r--r-- | test/068-classloader/src-ex/Inaccessible1.java | 11 | ||||
-rw-r--r-- | test/068-classloader/src-ex/Inaccessible2.java | 10 | ||||
-rw-r--r-- | test/068-classloader/src-ex/Inaccessible3.java | 10 |
11 files changed, 235 insertions, 0 deletions
diff --git a/test/068-classloader/src-ex/AbstractGet.java b/test/068-classloader/src-ex/AbstractGet.java new file mode 100644 index 0000000000..db13b32791 --- /dev/null +++ b/test/068-classloader/src-ex/AbstractGet.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2009 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. + */ + +/** + * Verify that we don't reject this with a LinkageError. + */ +public class AbstractGet extends AbstractBase { + public DoubledExtendOkay getExtended() { + return new DoubledExtendOkay(); + } +} + +/** + * Abstract class, does not declare getAbstract. This cause the VM to + * generate a "miranda" method. + */ +abstract class AbstractBase extends BaseOkay { + public abstract DoubledExtendOkay getExtended(); +} diff --git a/test/068-classloader/src-ex/DoubledExtend.java b/test/068-classloader/src-ex/DoubledExtend.java new file mode 100644 index 0000000000..6ad2708b11 --- /dev/null +++ b/test/068-classloader/src-ex/DoubledExtend.java @@ -0,0 +1,20 @@ +// Copyright 2008 The Android Open Source Project + +/** + * Doubled sub-class, form #2. + */ +public class DoubledExtend extends Base { + public DoubledExtend() { + //System.out.println("Ctor: doubled extend, type 2"); + } + + @Override + public DoubledExtend getExtended() { + //System.out.println("getExtended 2"); + return new DoubledExtend(); + } + + public String getStr() { + return "DoubledExtend 2"; + } +} diff --git a/test/068-classloader/src-ex/DoubledExtendOkay.java b/test/068-classloader/src-ex/DoubledExtendOkay.java new file mode 100644 index 0000000000..9674875b74 --- /dev/null +++ b/test/068-classloader/src-ex/DoubledExtendOkay.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2009 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. + */ + +/** + * "Okay" doubled sub-class, form #2. + */ +public class DoubledExtendOkay extends BaseOkay { + public DoubledExtendOkay() { + //System.out.println("Ctor: doubled extend okay, type 2"); + } + + /* + @Override + public DoubledExtendOkay getExtended() { + //System.out.println("getExtended 2"); + return new DoubledExtendOkay(); + } + */ + + public String getStr() { + return "DoubledExtendOkay 2"; + } +} diff --git a/test/068-classloader/src-ex/DoubledImplement.java b/test/068-classloader/src-ex/DoubledImplement.java new file mode 100644 index 0000000000..5c44fc3190 --- /dev/null +++ b/test/068-classloader/src-ex/DoubledImplement.java @@ -0,0 +1,18 @@ +// Copyright 2008 The Android Open Source Project + +/** + * Doubled sub-class, form #2. + */ +public class DoubledImplement implements ICommon { + public DoubledImplement() { + System.out.println("Ctor: doubled implement, type 2"); + } + + public DoubledImplement getDoubledInstance() { + return new DoubledImplement(); + } + + public void two() { + System.out.println("DoubledImplement two"); + } +} diff --git a/test/068-classloader/src-ex/DoubledImplement2.java b/test/068-classloader/src-ex/DoubledImplement2.java new file mode 100644 index 0000000000..24ecb65241 --- /dev/null +++ b/test/068-classloader/src-ex/DoubledImplement2.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2008 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. + */ + +/** + * Another doubled sub-class, form #2. + */ +public class DoubledImplement2 implements ICommon2 { + public DoubledImplement2() { + System.out.println("Ctor: doubled implement, type 2"); + } + + public DoubledImplement2 getDoubledInstance2() { + return new DoubledImplement2(); + } + + public void two() { + System.out.println("DoubledImplement2 two"); + } +} diff --git a/test/068-classloader/src-ex/GetDoubled.java b/test/068-classloader/src-ex/GetDoubled.java new file mode 100644 index 0000000000..28ada1e565 --- /dev/null +++ b/test/068-classloader/src-ex/GetDoubled.java @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2008 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. + */ + +/* + * The interface we implement was declared in a different class loader, + * which means the DoubledExtend we return is not the one it was declared + * to return. + */ +public class GetDoubled implements IGetDoubled { + public DoubledExtendOkay getDoubled() { + return new DoubledExtendOkay(); + } +} diff --git a/test/068-classloader/src-ex/IfaceImpl.java b/test/068-classloader/src-ex/IfaceImpl.java new file mode 100644 index 0000000000..7e9c27d710 --- /dev/null +++ b/test/068-classloader/src-ex/IfaceImpl.java @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2008 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 IfaceImpl implements IfaceSub { + public DoubledImplement2 getDoubledInstance2() { + return new DoubledImplement2(); + } +} diff --git a/test/068-classloader/src-ex/IfaceSub.java b/test/068-classloader/src-ex/IfaceSub.java new file mode 100644 index 0000000000..7e512e76f0 --- /dev/null +++ b/test/068-classloader/src-ex/IfaceSub.java @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2008 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 IfaceSub extends IfaceSuper { + public DoubledImplement2 getDoubledInstance2(); +} diff --git a/test/068-classloader/src-ex/Inaccessible1.java b/test/068-classloader/src-ex/Inaccessible1.java new file mode 100644 index 0000000000..415a8a1b62 --- /dev/null +++ b/test/068-classloader/src-ex/Inaccessible1.java @@ -0,0 +1,11 @@ +// Copyright 2008 The Android Open Source Project + +/** + * Non-public class, inaccessible from Main. Note the constructor is + * public. + */ +class Inaccessible1 extends SimpleBase { + public Inaccessible1() { + System.out.println("--- inaccessible1"); + } +} diff --git a/test/068-classloader/src-ex/Inaccessible2.java b/test/068-classloader/src-ex/Inaccessible2.java new file mode 100644 index 0000000000..dc20c21b97 --- /dev/null +++ b/test/068-classloader/src-ex/Inaccessible2.java @@ -0,0 +1,10 @@ +// Copyright 2008 The Android Open Source Project + +/** + * Public class that can't access its base. + */ +public class Inaccessible2 extends InaccessibleBase { + public Inaccessible2() { + System.out.println("--- inaccessible2"); + } +} diff --git a/test/068-classloader/src-ex/Inaccessible3.java b/test/068-classloader/src-ex/Inaccessible3.java new file mode 100644 index 0000000000..771d0f7acc --- /dev/null +++ b/test/068-classloader/src-ex/Inaccessible3.java @@ -0,0 +1,10 @@ +// Copyright 2008 The Android Open Source Project + +/** + * Public class that can't access its interface. + */ +public class Inaccessible3 implements InaccessibleInterface { + public Inaccessible3() { + System.out.println("--- inaccessible3"); + } +} |