Bug 6552 - Cannot implement an interface which has static methods
Summary: Cannot implement an interface which has static methods
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: Other Other
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2012-08-16 07:14 UTC by Steffen Kieß
Modified: 2012-09-04 07:48 UTC (History)
1 user (show)

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


Attachments
Output of "monodis I.dll" (3.53 KB, text/plain)
2012-08-16 07:14 UTC, Steffen Kieß
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 GitHub or Developer Community 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 Steffen Kieß 2012-08-16 07:14:16 UTC
Created attachment 2360 [details]
Output of "monodis I.dll"

Description of Problem:
mcs cannot compile a class which implements an interface which has static methods. Such interfaces are for example created by ikvmc in some situations.

Steps to reproduce the problem:
cat > I.java <<EOF
public interface I {
    public static int value = new Integer (1);
};
EOF
cat > Test.cs <<EOF
public class C : I {}
EOF
javac I.java
ikvmc -out:I.dll I.class
gmcs -target:library -r:I.dll Test.cs


Actual Results:
Test.cs(1,14): error CS0535: `C' does not implement interface member `I.__<clinit>()'
/tmp/I.dll (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings


Expected Results:
Successful compilation


Additional Information:
This problem appears both in Mono 2.10.8.1 and in the current git master (2e7da2d7657601ecac25c9c9bec2f9b5cfe3649f).
I've attached the output of "monodis I.dll".
Comment 1 Marek Safar 2012-09-04 07:48:20 UTC
Fixed in master