1 /*************************************************************************************** 2 * Copyright (c) Jonas Bonér, Alexandre Vasseur. All rights reserved. * 3 * http://aspectwerkz.codehaus.org * 4 * ---------------------------------------------------------------------------------- * 5 * The software in this package is published under the terms of the LGPL license * 6 * a copy of which has been included with this distribution in the license.txt file. * 7 **************************************************************************************/ 8 package test.aspect; 9 10 import test.Introductions; 11 12 import java.io.Serializable; 13 14 /*** 15 * Replacement for IntroductionTestAspect$MyImpl mixin 16 * 17 * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur </a> 18 */ 19 public class IntroductionTestAspectMyImplReplacement implements Serializable, Introductions { 20 public void noArgs() throws RuntimeException { 21 } 22 23 public long longArg(long arg) { 24 return arg; 25 } 26 27 /*** 28 * Used in test suite: replacement does a -2 x 29 */ 30 public int intArg(int arg) { 31 return -2 * arg; 32 } 33 34 public short shortArg(short arg) { 35 return arg; 36 } 37 38 public double doubleArg(double arg) { 39 return arg; 40 } 41 42 public float floatArg(float arg) { 43 return arg; 44 } 45 46 public byte byteArg(byte arg) { 47 return arg; 48 } 49 50 public boolean booleanArg(boolean arg) { 51 return arg; 52 } 53 54 public char charArg(char arg) { 55 return arg; 56 } 57 58 public Object objectArg(Object arg) { 59 return arg; 60 } 61 62 public String[] arrayArg(String[] arg) { 63 return arg; 64 } 65 66 public int variousArguments1(String str, int i, float f, Object o, long l) throws RuntimeException { 67 return str.hashCode() + i + (int) f + o.hashCode() + (int) l; 68 } 69 70 public int variousArguments2(float f, int i, String str1, Object o, long l, String str2) throws RuntimeException { 71 return (int) f + i + str1.hashCode() + o.hashCode() + (int) l + str2.hashCode(); 72 } 73 74 public void getVoid() throws RuntimeException { 75 } 76 77 public long getLong() throws RuntimeException { 78 return 1L; 79 } 80 81 public int getInt() throws RuntimeException { 82 return 1; 83 } 84 85 public short getShort() throws RuntimeException { 86 return 1; 87 } 88 89 public double getDouble() throws RuntimeException { 90 return 1.1D; 91 } 92 93 public float getFloat() throws RuntimeException { 94 return 1.1F; 95 } 96 97 public byte getByte() throws RuntimeException { 98 return Byte.parseByte("1"); 99 } 100 101 public char getChar() throws RuntimeException { 102 return 'A'; 103 } 104 105 public boolean getBoolean() throws RuntimeException { 106 return true; 107 } 108 109 public void exceptionThrower() throws Throwable { 110 throw new UnsupportedOperationException("this is a test"); 111 } 112 113 public void exceptionThrowerChecked() throws CheckedException { 114 throw new CheckedException(); 115 } 116 }