Skip to content

Commit 1e5d349

Browse files
committed
Further tweak for #1248
1 parent 67813ca commit 1e5d349

File tree

2 files changed

+41
-34
lines changed

2 files changed

+41
-34
lines changed

src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedMethod.java

+33-32
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ public AnnotatedMethod withAnnotations(AnnotationMap ann) {
6565
return new AnnotatedMethod(_typeContext, _method, ann, _paramAnnotations);
6666
}
6767

68-
/*
69-
/*****************************************************
70-
/* Annotated impl
71-
/*****************************************************
72-
*/
7368

7469
@Override
7570
public Method getAnnotated() { return _method; }
@@ -90,12 +85,6 @@ public JavaType getType() {
9085
return _typeContext.resolveType(_method.getGenericReturnType());
9186
}
9287

93-
@Deprecated
94-
@Override
95-
public Type getGenericType() {
96-
return _method.getGenericReturnType();
97-
}
98-
9988
/**
10089
* For methods, this returns declared return type, which is only
10190
* useful with getters (setters do not usually return anything;
@@ -106,6 +95,18 @@ public Class<?> getRawType() {
10695
return _method.getReturnType();
10796
}
10897

98+
@Deprecated
99+
@Override
100+
public Type getGenericType() {
101+
return _method.getGenericReturnType();
102+
}
103+
104+
/*
105+
/*****************************************************
106+
/* AnnotatedWithParams
107+
/*****************************************************
108+
*/
109+
109110
@Override
110111
public final Object call() throws Exception {
111112
return _method.invoke(null);
@@ -127,6 +128,27 @@ public final Object call1(Object arg) throws Exception {
127128
/********************************************************
128129
*/
129130

131+
@Override
132+
public int getParameterCount() {
133+
return getRawParameterTypes().length;
134+
}
135+
136+
@Override
137+
public Class<?> getRawParameterType(int index)
138+
{
139+
Class<?>[] types = getRawParameterTypes();
140+
return (index >= types.length) ? null : types[index];
141+
}
142+
143+
@Override
144+
public JavaType getParameterType(int index) {
145+
Type[] types = _method.getGenericParameterTypes();
146+
if (index >= types.length) {
147+
return null;
148+
}
149+
return _typeContext.resolveType(types[index]);
150+
}
151+
130152
@Override
131153
public Class<?> getDeclaringClass() { return _method.getDeclaringClass(); }
132154

@@ -167,11 +189,6 @@ public Object getValue(Object pojo) throws IllegalArgumentException
167189
/*****************************************************
168190
*/
169191

170-
@Override
171-
public int getParameterCount() {
172-
return getRawParameterTypes().length;
173-
}
174-
175192
public String getFullName() {
176193
return getDeclaringClass().getName() + "#" + getName() + "("
177194
+getParameterCount()+" params)";
@@ -189,22 +206,6 @@ public Type[] getGenericParameterTypes() {
189206
return _method.getGenericParameterTypes();
190207
}
191208

192-
@Override
193-
public Class<?> getRawParameterType(int index)
194-
{
195-
Class<?>[] types = getRawParameterTypes();
196-
return (index >= types.length) ? null : types[index];
197-
}
198-
199-
@Override
200-
public JavaType getParameterType(int index) {
201-
Type[] types = _method.getGenericParameterTypes();
202-
if (index >= types.length) {
203-
return null;
204-
}
205-
return _typeContext.resolveType(types[index]);
206-
}
207-
208209
public Class<?> getRawReturnType() {
209210
return _method.getReturnType();
210211
}

src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedParameter.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public final class AnnotatedParameter
3737
/**********************************************************
3838
*/
3939

40-
public AnnotatedParameter(AnnotatedWithParams owner, JavaType type, AnnotationMap annotations,
41-
int index)
40+
public AnnotatedParameter(AnnotatedWithParams owner, JavaType type,
41+
AnnotationMap annotations, int index)
4242
{
4343
super((owner == null) ? null : owner.getTypeContext(), annotations);
4444
_owner = owner;
@@ -91,6 +91,12 @@ public JavaType getType() {
9191
return _type;
9292
}
9393

94+
@Deprecated
95+
@Override
96+
public Type getGenericType() {
97+
return _owner.getGenericParameterType(_index);
98+
}
99+
94100
/*
95101
/**********************************************************
96102
/* AnnotatedMember extras

0 commit comments

Comments
 (0)