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 461815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:00:44+00:00 2026-05-12T23:00:44+00:00

I want to have a source file which can compile with javac / ecj

  • 0

I want to have a source file which can compile with javac / ecj set to Java 5 but not Java 6 (even if the underlying Java runtime is Java 6).

This is to be certain that the compiler level is set correctly in Eclipse 3.5 running with Java 6 installed, but where the result needs to run on a Java 5 installation.

For java 1.4 I could use “enum” as a variable name (which fails under Java 5 and later) but I cannot locate a similar approach for Java 5 versus 6 (and later).

Suggestions?

  • 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-05-12T23:00:45+00:00Added an answer on May 12, 2026 at 11:00 pm

    There’s nothing in the Java language that was removed between JDK5 and 6. The only thing which was added, as has been said, was the @Override annotation being allowable on interface methods – no keywords. Hence you are left with library diferences as the only cause of breaking changes, I’m afraid.

    These do exist, even in the core API; in an unusual fit of backwards-compatibility-breaking revelry they changed the signature of some methods on the ExecutorService interface. This was because the generic signatures of the methods were overly restrictive. This was a pure library change (although, being part of java.util, a pretty core library); nothing to do with any language-level modification.

    For example, from JDK5 :

    <T> T invokeAny(Collection<Callable<T>> tasks)
    

    to JDK6:

    <T> T invokeAny(Collection<? extends Callable<T>> tasks)
    

    This means that any program which contained code implementing this interface in JDK5, would not have compiled against JDK6. A snippet is easy to create; just let your IDE create an empty implementation of the JDK5 interface and then build against JDK6.

    Note: that the wildcard was added because the previous version would not have accepted a parameter like List<MyCallable<String>> (i.e. the collection being typed by some subclass of callable) whereas the later version does.

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

Sidebar

Related Questions

I have this problem: I want to generate a new source code file from
I have three source files in a folder. I simply want to compile them
I have to share my source code with someone else but I don't want
The following source file will not compile with the MSVC compiler (v15.00.30729.01): /* stest.c
I have C source code which i want want to build with Visual Studio
I have many source/text file, say file.cpp or file.txt . Now, I want to
In Java when you compile a .java file which defines a class, it creates
I have a .pyc file with no corresponding Python source code. I want to
I want to compile a shared library to other developers, but without shipping source
I want to have an image bound to a boolean and have the source

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.