[
https://issues.apache.org/jira/browse/EASYANT-75?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14904118#comment-14904118
]
ASF GitHub Bot commented on EASYANT-75:
---------------------------------------
GitHub user AQuillet opened a pull request:
https://github.com/apache/ant-easyant-core/pull/1
Compliance with J2SE 1.7
https://issues.apache.org/jira/browse/EASYANT-75
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/AQuillet/ant-easyant-core master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/ant-easyant-core/pull/1.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1
----
commit 7370ea0f2657ac1f73383de92cd5e7e778785855
Author: Adrien Quillet <[email protected]>
Date: 2015-09-23T07:37:46Z
Compliance with J2SE 1.7
https://issues.apache.org/jira/browse/EASYANT-75
----
> Class.getMethod / Class.invoke: compliance with J2SE 1.7
> --------------------------------------------------------
>
> Key: EASYANT-75
> URL: https://issues.apache.org/jira/browse/EASYANT-75
> Project: EasyAnt
> Issue Type: Bug
> Components: Core
> Affects Versions: 0.9, 0.10
> Reporter: Adrien Quillet
> Priority: Blocker
> Labels: compliance
> Attachments: ant-easyant-core-JIRA-75.patch
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> When running EasyAnt with J2SE 1.7, calling
> {{EasyAntEngine.guessEasyantCoreJarUrl()}} raises a
> {{NoSuchMethodException}}/{{IllegalArgumentException}}.
> *Code to fix:*
> {{EasyAntEngine.getLocalURL = conn.getClass().getMethod("getLocalURL",
> (Class<?>) null)}}
> {{URL localJarUrl = (URL) getLocalURL.invoke(conn, (Class<?>) null)}}
> *Fixed code:*
> {{EasyAntEngine.getLocalURL = conn.getClass().getMethod("getLocalURL", null)}}
> {{URL localJarUrl = (URL) getLocalURL.invoke(conn, null)}}
> *Reason:*
> From JES2 1.7 Javadoc, calling {{getMethod}} or {{invoke}} with no varArg or
> a {{null}} varArg is treated as if the method was called with an empty array
> (compliance with JES2 1.5).
> But calling those methods with a {{null}} varArg that is casted to
> {{Class<?>}} is treated as an array of {{Class<?>}} that contains one
> {{null}} element. So there is no matching method, hence the
> {{NoSuchMethodException}}/{{IllegalArgumentException}}.
> _see also:_
> http://stackoverflow.com/questions/5586862/weird-behaviour-of-getmethod-in-java-reflection-api-can-someone-explain-this
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)