title: Code Compiles in Eclipse but not through command prompt
body: <p>The following code compiles without any problem in Eclipse using JDK7 (I am using update 10, but should be reproducible with any version of JDK7), but fails when compiled through command line with exact same JDK. The class just provides stub implementation of interface methods.</p>
  
  <pre><code>import java.io.File;
  import java.io.IOException;
  import java.io.InputStream;
  import java.net.URL;
  import java.security.cert.X509Certificate;
  import java.util.Dictionary;
  import java.util.Enumeration;
  import java.util.List;
  import java.util.Map;
  
  import org.osgi.framework.Bundle;
  import org.osgi.framework.BundleContext;
  import org.osgi.framework.BundleException;
  import org.osgi.framework.ServiceReference;
  import org.osgi.framework.Version;
  
  
  public class TestBundle implements Bundle {
  
      /**
       * @param args
       */
      public static void main(String[] args) {
  
  
      }
  
      @Override
      public int compareTo(Bundle o) {
  
          return 0;
      }
  
      @Override
      public &lt;A&gt; A adapt(Class&lt;A&gt; arg0) {
  
          return null;
      }
  
      @Override
      public Enumeration&lt;URL&gt; findEntries(String arg0, String arg1, boolean arg2) {
  
          return null;
      }
  
      @Override
      public BundleContext getBundleContext() {
  
          return null;
      }
  
      @Override
      public long getBundleId() {
  
          return 0;
      }
  
      @Override
      public File getDataFile(String arg0) {
  
          return null;
      }
  
      @Override
      public URL getEntry(String arg0) {
  
          return null;
      }
  
      @Override
      public Enumeration&lt;String&gt; getEntryPaths(String arg0) {
  
          return null;
      }
  
      @Override
      public Dictionary&lt;String, String&gt; getHeaders() {
  
          return null;
      }
  
      @Override
      public Dictionary&lt;String, String&gt; getHeaders(String arg0) {
  
          return null;
      }
  
      @Override
      public long getLastModified() {
  
          return 0;
      }
  
      @Override
      public String getLocation() {
  
          return null;
      }
  
      @Override
      public ServiceReference&lt;?&gt;[] getRegisteredServices() {
  
          return null;
      }
  
      @Override
      public URL getResource(String arg0) {
  
          return null;
      }
  
      @Override
      public Enumeration&lt;URL&gt; getResources(String arg0) throws IOException {
  
          return null;
      }
  
      @Override
      public ServiceReference&lt;?&gt;[] getServicesInUse() {
  
          return null;
      }
  
      @Override
      public Map&lt;X509Certificate, List&lt;X509Certificate&gt;&gt; getSignerCertificates(
              int arg0) {
  
          return null;
      }
  
      @Override
      public int getState() {
  
          return 0;
      }
  
      @Override
      public String getSymbolicName() {
  
          return null;
      }
  
      @Override
      public Version getVersion() {
  
          return null;
      }
  
      @Override
      public boolean hasPermission(Object arg0) {
  
          return false;
      }
  
      @Override
      public Class&lt;?&gt; loadClass(String arg0) throws ClassNotFoundException {
  
          return null;
      }
  
      @Override
      public void start() throws BundleException {
  
  
      }
  
      @Override
      public void start(int arg0) throws BundleException {
  
  
      }
  
      @Override
      public void stop() throws BundleException {
  
  
      }
  
      @Override
      public void stop(int arg0) throws BundleException {
  
  
      }
  
      @Override
      public void uninstall() throws BundleException {
  
  
      }
  
      @Override
      public void update() throws BundleException {
  
  
      }
  
      @Override
      public void update(InputStream arg0) throws BundleException {
  
  
      }
  
  }
  </code></pre>
  
  <p>The jar file for osgi can be downloaded from <a href="http://repo1.maven.org/maven2/org/eclipse/birt/runtime/org.eclipse.osgi/3.8.0.v20120529-1548/" rel="nofollow">here</a></p>
  
  <p>I am using the following command to compile this via command line:</p>
  
  <pre><code>javac.exe -cp org.eclipse.osgi_3.8.0.v20120529-1548.jar TestBundle.java
  </code></pre>
  
  <p>It gives following error when compiled through command line:</p>
  
  <pre><code>TestBundle.java:101: error: type ServiceReference does not take parameters
          public ServiceReference&lt;?&gt;[] getRegisteredServices() {
                                 ^
  TestBundle.java:119: error: type ServiceReference does not take parameters
          public ServiceReference&lt;?&gt;[] getServicesInUse() {
                                 ^
  TestBundle.java:18: error: TestBundle is not abstract and does not override abstract method adapt(Class) in Bundle
  public class TestBundle implements Bundle {
         ^
  TestBundle.java:28: error: method does not override or implement a method from a supertype
          @Override
          ^
  TestBundle.java:35: error: name clash: &lt;A&gt;adapt(Class&lt;A&gt;) in TestBundle and adapt(Class) in Bundle have the same erasure, yet neither overrides the other
          public &lt;A&gt; A adapt(Class&lt;A&gt; arg0) {
                       ^
    where A is a type-variable:
      A extends Object declared in method &lt;A&gt;adapt(Class&lt;A&gt;)
  TestBundle.java:34: error: method does not override or implement a method from a supertype
          @Override
          ^
  6 errors
  </code></pre>