Issue Details (XML | Word | Printable)

Key: GROOVY-1858
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Paul King
Reporter: Robert Stroud
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
groovy

Fix warnings about @deprecated methods for DelegatingMetaClass, ProxyMetaClass, and MockProxyMetaClass

Created: 27/Apr/07 08:29 AM   Updated: 26/Sep/07 08:23 PM
Component/s: groovy-jdk
Affects Version/s: None
Fix Version/s: 1.1-beta-2

Time Tracking:
Not Specified


 Description  « Hide
Building Groovy from source gives 5 warning messages from javac about deprecated methods - enabling the <deprecation> parameter to the <javac> task (see below) reveals that all of these messages are the result of meta class implementations extending or implementing a deprecated method without declaring that the method is deprecated. The fix is very simple - just add the missing @deprecated declaration to DelegatingMetaClass (invokeConstructorAt), ProxyMetaClass (invokeMethod), and MockProxyMetaClass (invokeMethod).

The confusing warning message for GPathResult.java will disappear as a result of fixing DelegatingMetaClass, which is extended by an anonymous inner class, resulting in the warning message that the compiler bizarrely associates with the declaration of the setAttribute method!

[javac] [...]/groovy-core/src/main/groovy/lang/DelegatingMetaClass.java:185: warning: [deprecation] invokeConstructorAt(java.lang.Class,java.lang.Object[]) in groovy.lang.MetaClass has been deprecated
[javac] public Object invokeConstructorAt(Class at, Object[] arguments) {
[javac] ^
[javac] [...]//groovy-core/src/main/groovy/lang/DelegatingMetaClass.java:186: warning: [deprecation] invokeConstructorAt(java.lang.Class,java.lang.Object[]) in groovy.lang.MetaClass has been deprecated
[javac] return this.delegate.invokeConstructorAt(at, arguments);
[javac] ^
[javac] [...]//groovy-core/src/main/groovy/lang/ProxyMetaClass.java:117: warning: [deprecation] invokeMethod(java.lang.Object,java.lang.String,java.lang.Object[]) in groovy.lang.MetaClassImpl has been deprecated
[javac] public Object invokeMethod(final Object object, final String methodName, final Object[] arguments) {
[javac] ^
[javac] [...]//groovy-core/src/main/groovy/mock/interceptor/MockProxyMetaClass.java:32: warning: [deprecation] invokeMethod(java.lang.Object,java.lang.String,java.lang.Object[]) in groovy.lang.MetaClassImpl has been deprecated
[javac] public Object invokeMethod(final Object object, final String methodName, final Object[] arguments) {
[javac] ^
[javac] [...]//groovy-core/src/main/groovy/util/slurpersupport/GPathResult.java:93: warning: [deprecation] invokeConstructorAt(java.lang.Class,java.lang.Object[]) in groovy.lang.MetaClass has been deprecated
[javac] public void setAttribute(final Object object, final String attribute, final Object newValue) {
[javac] ^
[javac] 5 warnings
[echo] Groovyc of main code.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Paul King added a comment - 16/Jun/07 05:54 PM
made deprecation='on' the default in the build. removed all warnings. One deprecated javadoc was reverted back as I think it only comes into play once we have MOP 2.0. I left a TODO to examine in its place.

Paul King added a comment - 26/Sep/07 08:23 PM
No further feedback, assuming fixed