Mono build fails on usage of ambiguous String.split(char[*], int) method 
signature
----------------------------------------------------------------------------------

                 Key: NPANDAY-415
                 URL: https://issues.apache.org/jira/browse/NPANDAY-415
             Project: NPanday
          Issue Type: Bug
          Components: Maven Plugins
    Affects Versions: 1.3.1-incubating
         Environment: $ mvn -v
Apache Maven 2.2.1 (rdebian-4)
Java version: 1.6.0_24
Java home: /usr/lib/jvm/java-6-sun-1.6.0.24/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.35-28-generic" arch: "amd64" Family: "unix"

            Reporter: John R. Fallows


When building NPanday.Artifact project with Mono on Linux the following error 
is presented.

{code}
[INFO] 
/home/jfallows/Workspaces/npanday-trunk/dotnet/assemblies/NPanday.Artifact/target/build-sources/NPanday/Artifact/ArtifactRepository.cs(60,35):
 error CS0121: The call is ambiguous between the following methods or 
properties: `string.Split(char[*], int)' and `string.Split(char[*], int)'
[INFO] /usr/lib/mono/2.0/mscorlib.dll (Location of the symbol related to 
previous error)
Compilation failed: 1 error(s), 51 warnings
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] NPANDAY-900-006: Unable to Compile: Language = C_SHARP, Vendor = null, 
ArtifactType = library, Source Directory = 
/home/jfallows/Workspaces/npanday-trunk/dotnet/assemblies/NPanday.Artifact/src/main/csharp

Embedded error: NPANDAY-040-001: Could not execute: Command =  /bin/sh -c cd 
/usr/lib/mono/2.0 && gmcs 
@/home/jfallows/Workspaces/npanday-trunk/dotnet/assemblies/NPanday.Artifact/target/1920634/responsefile.rsp,
 Result = 1
{code}

This is caused by method signatures with Enum types being reduced to type int 
in Mono, and in this specific case it causes a collision with an existing 
String.split method signature that really does have an int parameter.

An example of the code causing the error can be found in ArtifactRepository.cs, 
line 60:
{code}
String[] tokens = uri.Split("/".ToCharArray(), 
StringSplitOptions.RemoveEmptyEntries);
{code}

A simple fix that keeps the precise meaning of the original code but makes the 
method signature unambiguous:
{code]
String[] tokens = uri.Split("/".ToCharArray(), Int32.MaxValue, 
StringSplitOptions.RemoveEmptyEntries);
{code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to