Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9068885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:17:52+00:00 2026-06-16T17:17:52+00:00

The following code compiles without any problem in Eclipse using JDK7 (I am using

  • 0

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.

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 <A> A adapt(Class<A> arg0) {

        return null;
    }

    @Override
    public Enumeration<URL> 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<String> getEntryPaths(String arg0) {

        return null;
    }

    @Override
    public Dictionary<String, String> getHeaders() {

        return null;
    }

    @Override
    public Dictionary<String, String> getHeaders(String arg0) {

        return null;
    }

    @Override
    public long getLastModified() {

        return 0;
    }

    @Override
    public String getLocation() {

        return null;
    }

    @Override
    public ServiceReference<?>[] getRegisteredServices() {

        return null;
    }

    @Override
    public URL getResource(String arg0) {

        return null;
    }

    @Override
    public Enumeration<URL> getResources(String arg0) throws IOException {

        return null;
    }

    @Override
    public ServiceReference<?>[] getServicesInUse() {

        return null;
    }

    @Override
    public Map<X509Certificate, List<X509Certificate>> 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<?> 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 {


    }

}

The jar file for osgi can be downloaded from here

I am using the following command to compile this via command line:

javac.exe -cp org.eclipse.osgi_3.8.0.v20120529-1548.jar TestBundle.java

It gives following error when compiled through command line:

TestBundle.java:101: error: type ServiceReference does not take parameters
        public ServiceReference<?>[] getRegisteredServices() {
                               ^
TestBundle.java:119: error: type ServiceReference does not take parameters
        public ServiceReference<?>[] 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: <A>adapt(Class<A>) in TestBundle and adapt(Class) in Bundle have the same erasure, yet neither overrides the other
        public <A> A adapt(Class<A> arg0) {
                     ^
  where A is a type-variable:
    A extends Object declared in method <A>adapt(Class<A>)
TestBundle.java:34: error: method does not override or implement a method from a supertype
        @Override
        ^
6 errors
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T17:17:53+00:00Added an answer on June 16, 2026 at 5:17 pm

    The OSGi spec bundles have an issue with generics when compiled on Java 7. This is because the bundles where compiled with backwards compatibility for jdk 1.4 which makes them break in Jdk 7. After a lot of complaints a new version was released that is compliant to jdk 7 now.

    The 4.3.1 sources are identically to 4.3.0. It is just recompiled. You should be able to compile your code with this jar. I am not sure how this relates to the jar from eclipse you used but I guess they just used the old compiled spec classes.

    http://search.maven.org/remotecontent?filepath=org/osgi/org.osgi.core/4.3.1/org.osgi.core-4.3.1.jar

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code compiles in Visual C++ and gcc, but fails with Code Warrior
Possible Duplicate: What does main return? For example, the following code compiles without any
I have following piece of code: It compiles without problems under gcc-3.4, gcc-4.3, intel
the following code compiles with Visual Studio 2008 but not with g++ on Mac
I came across the following code that compiles fine (using Visual Studio 2005): SomeObject
Visual Studio 2008 I am using the following source code that compiles ok using
Consider the following code snippet, which is a reduced version of my original problem:
gcc compiles the following code without error. I'm creating a bubble sort function that
Consider the following code: int main() { int *p; ++((int){5}); //compile without err/warning &((int){5});
The following source code compiles correctly with Visual Studio 2010: namespace NS { class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.