Bug 5020 - Jar project creating duplicates in generated code.
Summary: Jar project creating duplicates in generated code.
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Android Add-in ()
Version: unspecified
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2012-05-10 21:00 UTC by kenny goers
Modified: 2016-08-03 15:37 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Project, zipped. (743.23 KB, application/zip)
2012-05-10 21:00 UTC, kenny goers
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description kenny goers 2012-05-10 21:00:04 UTC
Created attachment 1856 [details]
Project, zipped.

I'm getting the following error after getting my JARs imported with their references, appears to happen at the end of the build and the code that is generated contains duplicates, I've attached the project with the JAR files.


Building: Jericho (Debug)

Build started 5/10/2012 7:44:58 PM.
__________________________________________________
Project "/Users/mac/Projects/FragmentTesting/Jericho/Jericho.csproj" (Build target(s)):
	
	Target _ResolveMonoAndroidSdks:
		MonoAndroid Tools: /Developer/MonoAndroid/usr/lib/mandroid/
		MonoAndroid Framework: /Developer/MonoAndroid/usr/lib/mandroid/platforms/android-8;/Developer/MonoAndroid/usr/lib/mono/2.1
		Android SDK: /Users/mac/Projects/android-sdk-mac_86/
		Java SDK: /usr/
	
	Target ResolveLibraryProjects:
	No input files were specified for target ResolveLibraryProjects, skipping.
	
	Target ExportJarToXml:
		  SourceJars:
		    Jars/jericho-html-3.2.jar
		  ReferenceJars:
		    Additions/AboutAdditions.txt
		    Jars/slf4j-api-1.6.4.jar
		    Jars/log4j-1.2.16.jar
		Tool /usr/bin/java execution started with arguments: -jar /Developer/MonoAndroid/usr/lib/mandroid/jar2xml.jar --jar=/Users/mac/Projects/FragmentTesting/Jericho/Jars/jericho-html-3.2.jar --ref=/Users/mac/Projects/android-sdk-mac_86/platforms/android-8/android.jar --out=/Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/api.xml --ref=/Users/mac/Projects/FragmentTesting/Jericho/Additions/AboutAdditions.txt --ref=/Users/mac/Projects/FragmentTesting/Jericho/Jars/slf4j-api-1.6.4.jar --ref=/Users/mac/Projects/FragmentTesting/Jericho/Jars/log4j-1.2.16.jar 
	
	Target PrepareForBuild:
		Configuration: Debug Platform: AnyCPU
	
	Target GenerateBindings:
		  TransformFiles:
		    Transforms/EnumFields.xml
		    Transforms/EnumMethods.xml
		    Transforms/Metadata.xml
		  ReferencedManagedLibraries:
		    /Developer/MonoAndroid/usr/lib/mono/2.1/System.dll
		    /Developer/MonoAndroid/usr/lib/mono/2.1/System.Xml.dll
		    /Developer/MonoAndroid/usr/lib/mandroid/platforms/android-8/Mono.Android.dll
		    /Developer/MonoAndroid/usr/lib/mono/2.1/System.Core.dll
		Adding transform file Transforms/EnumFields.xml as enumfields.
		Adding transform file Transforms/EnumMethods.xml as enummethods.
		Adding transform file Transforms/Metadata.xml as metadata.
		Tool /Developer/MonoAndroid/usr/bin/generator execution started with arguments: obj/Debug/api.xml --csdir=obj/Debug/generated/src --enumdir=obj/Debug/generated/enums --enummetadata=obj/Debug/generated/metadata --assembly=Jericho --ref=/Developer/MonoAndroid/usr/lib/mono/2.1/mscorlib.dll --ref=/Developer/MonoAndroid/usr/lib/mono/2.1/System.dll --ref=/Developer/MonoAndroid/usr/lib/mono/2.1/System.Xml.dll --ref=/Developer/MonoAndroid/usr/lib/mandroid/platforms/android-8/Mono.Android.dll --ref=/Developer/MonoAndroid/usr/lib/mono/2.1/System.Core.dll --enumfields=Transforms/EnumFields.xml --enummethods=Transforms/EnumMethods.xml --fixup=Transforms/Metadata.xml --api-level=8 --global --public 
		resolving assembly /Developer/MonoAndroid/usr/lib/mono/2.1/mscorlib.dll
		resolving assembly /Developer/MonoAndroid/usr/lib/mono/2.1/System.dll
		resolving assembly /Developer/MonoAndroid/usr/lib/mono/2.1/System.Xml.dll
		resolving assembly /Developer/MonoAndroid/usr/lib/mandroid/platforms/android-8/Mono.Android.dll
		resolving assembly /Developer/MonoAndroid/usr/lib/mono/2.1/System.Core.dll
		Class Net.Htmlparser.Jericho.Nodoc.SequentialListSegment.SubList has unknown base type java.util.AbstractList
		Unknown return type java.util.Iterator<E> found in method Iterator in type Net.Htmlparser.Jericho.Nodoc.SequentialListSegment
		Unknown return type java.util.ListIterator<E> found in method ListIterator in type Net.Htmlparser.Jericho.Nodoc.SequentialListSegment
		Unknown return type java.util.ListIterator<E> found in method ListIterator in type Net.Htmlparser.Jericho.Nodoc.SequentialListSegment
		Class Net.Htmlparser.Jericho.FormFields has unknown base type java.util.AbstractCollection
		Invalid parameter type net.htmlparser.jericho.FormFields found in method Replace in type Net.Htmlparser.Jericho.OutputDocument
		Unknown return type java.util.Iterator<net.htmlparser.jericho.Element> found in method GetOptionElementIterator in type Net.Htmlparser.Jericho.FormControl
		Unknown return type java.util.Iterator<net.htmlparser.jericho.Segment> found in method Iterator in type Net.Htmlparser.Jericho.Source
		Unknown return type java.util.ListIterator<net.htmlparser.jericho.Attribute> found in method ListIterator in type Net.Htmlparser.Jericho.Attributes
		Invalid return type net.htmlparser.jericho.FormFields found in method GetFormFields in type Net.Htmlparser.Jericho.Segment
		Unknown return type java.util.Iterator<net.htmlparser.jericho.Segment> found in method GetNodeIterator in type Net.Htmlparser.Jericho.Segment
		Class Net.Htmlparser.Jericho.BasicLogFormatter has unknown base type java.util.logging.Formatter
		Unknown return type java.util.Iterator<net.htmlparser.jericho.Segment> found in method Iterator in type Net.Htmlparser.Jericho.StreamedSource
	
	Target GenerateSatelliteAssemblies:
	No input files were specified for target GenerateSatelliteAssemblies, skipping.
	
	Target CoreCompile:
		Tool /Developer/MonoAndroid/usr/lib/mandroid/../../bin/smcs execution started with arguments: /noconfig /debug:full /debug+ /optimize- /out:obj/Debug/Jericho.dll Properties/AssemblyInfo.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Java.Interop.__TypeRegistrations.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.Attribute.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.Attributes.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.CharStreamSourceUtil.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.CharacterEntityReference.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.CharacterReference.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.Config.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.Element.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.EndTag.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.EndTagType.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.EndTagTypeGenericImplementation.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.FormControl.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.FormControlOutputStyle.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.FormControlType.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.FormField.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.HTMLElements.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.ICharStreamSource.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.IHTMLElementName.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.ILogger.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.ILoggerProvider.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.IOutputSegment.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.IParseText.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.MasonTagTypes.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.MicrosoftConditionalCommentTagTypes.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.MicrosoftTagTypes.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.Nodoc.SequentialListSegment.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.NumericCharacterReference.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.OutputDocument.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.PHPTagTypes.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.Renderer.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.RowColumnVector.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.Segment.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.Source.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.SourceCompactor.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.SourceFormatter.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.StartTag.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.StartTagType.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.StartTagTypeGenericImplementation.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.StreamedSource.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.Tag.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.TagType.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.TextExtractor.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.Util.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.WriterLogger.cs /Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/__NamespaceMapping__.cs /target:library /define:DEBUG /reference:/Developer/MonoAndroid/usr/lib/mono/2.1/System.dll /reference:/Developer/MonoAndroid/usr/lib/mono/2.1/System.Xml.dll /reference:/Developer/MonoAndroid/usr/lib/mandroid/platforms/android-8/Mono.Android.dll /reference:/Developer/MonoAndroid/usr/lib/mono/2.1/System.Core.dll /warn:4
/Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.IParseText.cs(473,33): error CS0102: The type `Net.Htmlparser.Jericho.IParseTextInvoker' already contains a definition for `cb_subSequence_II'
		/Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.IParseText.cs(425,33): (Location of the symbol related to previous error)
/Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.IParseText.cs(489,24): error CS0102: The type `Net.Htmlparser.Jericho.IParseTextInvoker' already contains a definition for `id_subSequence_II'
		/Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.IParseText.cs(441,24): (Location of the symbol related to previous error)
	Task "Csc" execution -- FAILED
	Done building target "CoreCompile" in project "/Users/mac/Projects/FragmentTesting/Jericho/Jericho.csproj".-- FAILED
	
Done building project "/Users/mac/Projects/FragmentTesting/Jericho/Jericho.csproj".-- FAILED

Build FAILED.
Errors:

/Users/mac/Projects/FragmentTesting/Jericho/Jericho.csproj (Build) ->
/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/4.0/Microsoft.CSharp.Targets (CoreCompile target) ->

	/Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.IParseText.cs(473,33): error CS0102: The type `Net.Htmlparser.Jericho.IParseTextInvoker' already contains a definition for `cb_subSequence_II'
	/Users/mac/Projects/FragmentTesting/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.IParseText.cs(489,24): error CS0102: The type `Net.Htmlparser.Jericho.IParseTextInvoker' already contains a definition for `id_subSequence_II'

	 0 Warning(s)
	 2 Error(s)

Time Elapsed 00:00:04.5093430

---------------------- Done ----------------------

Build: 2 errors, 0 warnings
Comment 1 kenny goers 2012-05-10 21:01:36 UTC
Oops, project attached had a text file as a reference JAR, removing it didn't fix the problem...
Comment 2 Atsushi Eno 2012-05-22 06:13:32 UTC
There were two issues exposed in this repro:

1) duplicate property callback handlers (as exposed in the compile errors above). This was about interface invokers for CharSequence.
2) incorrect renaming of boolean "Is" setter properties. Error example below:

	/home/atsushi/デスクトップ/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.WriterLogger.cs(8,30): error CS0535: `Net.Htmlparser.Jericho.WriterLogger' does not implement interface member `Net.Htmlparser.Jericho.ILogger.IsDebugEnabled.get'
	/home/atsushi/デスクトップ/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.WriterLogger.cs(8,30): error CS0535: `Net.Htmlparser.Jericho.WriterLogger' does not implement interface member `Net.Htmlparser.Jericho.ILogger.IsErrorEnabled.get'
	/home/atsushi/デスクトップ/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.WriterLogger.cs(8,30): error CS0535: `Net.Htmlparser.Jericho.WriterLogger' does not implement interface member `Net.Htmlparser.Jericho.ILogger.IsInfoEnabled.get'
	/home/atsushi/デスクトップ/Jericho/obj/Debug/generated/src/Net.Htmlparser.Jericho.WriterLogger.cs(8,30): error CS0535: `Net.Htmlparser.Jericho.WriterLogger' does not implement interface member `Net.Htmlparser.Jericho.ILogger.IsWarnEnabled.get'

They were renamed to e.g. DebugEnabled in WriterLogger class as it has both getter (isDebugEnabled). But since setter (setDebugEnabled) while its interface Logger only has the getter (isDebugEnabled) and left as IsDebugEnabled property, this resulted in missing interface implementation.

These issues are now fixed. This will be *next version to* the upcoming 4.2.x release (sorry but the upcoming release is already in preparation).

Thanks for the report.
Comment 3 Atsushi Eno 2012-05-22 06:17:27 UTC
BTW I needed some metadata fixup (Transforms/Metadata.xml) since this member ("JAVA" field which becomes "Java" field in C#) conflicts our package name ("Java"):

<metadata>
  <attr path="/api/package[@name='net.htmlparser.jericho']/interface[@name='LoggerProvider']/field[@name='JAVA']" name="managedName">JavaProvider</attr> 
</metadata>


Also if you need a workaround for this bug, remove "WriterLogger" class from the binding. Insert the line below inside <metadata> element:

  <remove-node path="/api/package[@name='net.htmlparser.jericho']/class[@name='WriterLogger']" />