1 package testproxy; 2 3 import javassist.util.proxy.MethodHandler; 4 import java.lang.reflect.Method; 5 6 public class Target189 { 7 public interface TestProxy { 8 } 9 10 public static class TestMethodHandler implements MethodHandler { 11 12 int invoked = 0; 13 invoke(Object self, Method thisMethod, Method proceed, Object[] args)14 public Object invoke(Object self, Method thisMethod, Method proceed, 15 Object[] args) throws Throwable { 16 invoked++; 17 return proceed.invoke(self, args); 18 } 19 wasInvokedOnce()20 public boolean wasInvokedOnce() { 21 return invoked == 1; 22 } 23 reset()24 public void reset() { 25 invoked = 0; 26 } 27 } 28 29 public static class Issue { 30 31 private Integer id; 32 getId()33 public Integer getId() { 34 return id; 35 } 36 setId(Integer id)37 public void setId(Integer id) { 38 this.id = id; 39 } 40 } 41 42 public static class PublishedIssue extends Issue { 43 } 44 45 public static abstract class Article { 46 private Integer id; 47 getId()48 public Integer getId() { 49 return id; 50 } 51 setId(Integer id)52 public void setId(Integer id) { 53 this.id = id; 54 } 55 getIssue()56 public abstract Issue getIssue(); 57 } 58 59 public static class PublishedArticle extends Article { 60 61 private PublishedIssue issue; 62 63 @Override getIssue()64 public PublishedIssue getIssue() { 65 return issue; 66 } 67 setIssue(PublishedIssue issue)68 public void setIssue(PublishedIssue issue) { 69 this.issue = issue; 70 } 71 72 } 73 74 } 75