Merge pull request #105 from yiduwangkai/master

add IncompleteAnnotationException And AnnotationTypeMismatchException
diff --git a/java_exception.go b/java_exception.go
index 6190c18..abe725d 100644
--- a/java_exception.go
+++ b/java_exception.go
@@ -17,6 +17,7 @@
 import "github.com/dubbogo/hessian2/java_exception"
 
 func init() {
+	RegisterPOJO(&java_exception.Method{})
 	RegisterPOJO(&java_exception.Class{})
 	RegisterPOJO(&java_exception.Throwable{})
 	RegisterPOJO(&java_exception.Exception{})
@@ -105,4 +106,6 @@
 	RegisterPOJO(&java_exception.MissingFormatArgumentException{})
 	RegisterPOJO(&java_exception.MissingFormatWidthException{})
 	RegisterPOJO(&java_exception.DubboGenericException{})
+	RegisterPOJO(&java_exception.IncompleteAnnotationException{})
+	RegisterPOJO(&java_exception.AnnotationTypeMismatchException{})
 }
diff --git a/java_exception/annotation_type_mismatch_exception.go b/java_exception/annotation_type_mismatch_exception.go
new file mode 100644
index 0000000..e1b44ff
--- /dev/null
+++ b/java_exception/annotation_type_mismatch_exception.go
@@ -0,0 +1,37 @@
+// Copyright 2016-2019 yiduwangkai@gmail.com
+//
+// 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.
+
+package java_exception
+
+type AnnotationTypeMismatchException struct {
+	SerialVersionUID     int64
+	DetailMessage        string
+	StackTrace           []StackTraceElement
+	FoundType            string
+	Element              Method
+	SuppressedExceptions []Throwabler
+	Cause                Throwabler
+}
+
+func NewAnnotationTypeMismatchException(detailMessage string) *AnnotationTypeMismatchException {
+	return &AnnotationTypeMismatchException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}}
+}
+
+func (e AnnotationTypeMismatchException) Error() string {
+	return e.DetailMessage
+}
+
+func (AnnotationTypeMismatchException) JavaClassName() string {
+	return "java.lang.annotation.AnnotationTypeMismatchException"
+}
diff --git a/java_exception/exception.go b/java_exception/exception.go
index 2a458a2..73a4477 100644
--- a/java_exception/exception.go
+++ b/java_exception/exception.go
@@ -90,6 +90,15 @@
 	Name string
 }
 
+type Method struct {
+	Name string
+}
+
+
+func (Method) JavaClassName() string {
+	return "java.lang.reflect.Method"
+}
+
 func (Class) JavaClassName() string {
 	return "java.lang.Class"
 }
diff --git a/java_exception/incomplete_annotation_exception.go b/java_exception/incomplete_annotation_exception.go
new file mode 100644
index 0000000..b18378a
--- /dev/null
+++ b/java_exception/incomplete_annotation_exception.go
@@ -0,0 +1,37 @@
+// Copyright 2016-2019 yiduwangkai@gmail.com
+//
+// 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.
+
+package java_exception
+
+type IncompleteAnnotationException struct {
+	SerialVersionUID     int64
+	DetailMessage        string
+	StackTrace           []StackTraceElement
+	ElementName          string
+	AnnotationType       Class
+	SuppressedExceptions []Throwabler
+	Cause                Throwabler
+}
+
+func NewIncompleteAnnotationException(detailMessage string) *IncompleteAnnotationException {
+	return &IncompleteAnnotationException{DetailMessage: detailMessage, StackTrace: []StackTraceElement{}}
+}
+
+func (e IncompleteAnnotationException) Error() string {
+	return e.DetailMessage
+}
+
+func (IncompleteAnnotationException) JavaClassName() string {
+	return "java.lang.annotation.IncompleteAnnotationException"
+}
diff --git a/java_exception_test.go b/java_exception_test.go
index 9028c13..6af7841 100644
--- a/java_exception_test.go
+++ b/java_exception_test.go
@@ -107,6 +107,8 @@
 	doTestException(t, "throw_MissingFormatArgumentException", "Format specifier 'MissingFormatArgumentException'")
 	doTestException(t, "throw_MissingFormatWidthException", "MissingFormatWidthException")
 	doTestException(t, "throw_DubboGenericException", "DubboGenericException")
+	doTestException(t, "throw_IncompleteAnnotationException", "java.lang.Override missing element IncompleteAnnotationException")
+	doTestException(t, "throw_AnnotationTypeMismatchException", "Incorrectly typed data found for annotation element null (Found data of type AnnotationTypeMismatchException)")
 }
 
 func doTestException(t *testing.T, method, content string) {
diff --git a/test_hessian/src/main/java/test/TestThrowable.java b/test_hessian/src/main/java/test/TestThrowable.java
index 686f379..7e40b7e 100644
--- a/test_hessian/src/main/java/test/TestThrowable.java
+++ b/test_hessian/src/main/java/test/TestThrowable.java
@@ -18,6 +18,8 @@
 import com.alibaba.dubbo.rpc.service.GenericException;
 
 import java.io.*;
+import java.lang.annotation.AnnotationTypeMismatchException;
+import java.lang.annotation.IncompleteAnnotationException;
 import java.lang.instrument.IllegalClassFormatException;
 import java.lang.instrument.UnmodifiableClassException;
 import java.lang.invoke.LambdaConversionException;
@@ -395,4 +397,13 @@
   public static Object throw_DubboGenericException() {
     return new GenericException("DubboGenericExceptionClass","DubboGenericException");
   }
+
+  public static Object throw_IncompleteAnnotationException() {
+    return new IncompleteAnnotationException(Override.class, "IncompleteAnnotationException");
+  }
+
+  public static Object throw_AnnotationTypeMismatchException() {
+    return new AnnotationTypeMismatchException(Override.class.getEnclosingMethod(), "AnnotationTypeMismatchException");
+  }
+
 }