1

We recently decided to migrate our solution from java 7 to 8. However at the first step we found that there are some implementation changes in java 8 like String.split() method Here that can cause problem to codes written in Java 7!!

we rolled baked our project to Java 7 for now to investigate more on those differences.

Do you know any other changes in Java 8 can cause the same problem ?

PS: I know Java 8 new features By changes I mean those changes with the same API(method signature) but different implementation which can lead to different outcome!! like this method -> String.split()

Before down vote read the comments!!

Community
  • 1
  • 1
Morteza Adi
  • 2,413
  • 2
  • 22
  • 37
  • 1
    There are none. If you get different output, most likely your code (or the code you call) changed – Stultuske Aug 25 '15 at 09:02
  • 1
    @Stultuske so you don't know nothing on java 8 changes take a look at http://stackoverflow.com/questions/22718744/why-in-java-8-split-sometimes-removes-empty-strings-at-start-of-result-array – Morteza Adi Aug 25 '15 at 09:03
  • 1
    I think that `String.split()` was actually improved in Java8. – itwasntme Aug 25 '15 at 09:04
  • 1
    @itwasntme yes Improved but may cause different result!! look at the link above – Morteza Adi Aug 25 '15 at 09:05
  • There are also changes in what type inference will do in some edge cases. – Marko Topolnik Aug 25 '15 at 09:08
  • @MarkoTopolnik thanks finally a sensible answer!! can you post an example please? – Morteza Adi Aug 25 '15 at 09:09
  • @MortezaAdi: in that case, if you have different results, you were using it in a way Oracle didn't intend you to use it. They merely 'corrected' what they thought was a flaw in the code, thus improving it. Here is the 'official list' with updates: https://www.java.com/en/download/faq/release_changes.xml I see nothing there about the split method, though, so it's possible there are more changes out there, that had 'flaws' that were corrected. – Stultuske Aug 25 '15 at 09:09
  • @Stultuske I seek those changes you think it had flaws!! and not mentioned in release changes!! like Split method – Morteza Adi Aug 25 '15 at 09:12
  • @MortezaAdi: I don't think they had flaws, it just appears Oracle thought so. Since those changes are not mentioned in the list with updates published by Oracle, finding them all might mean going through the source code and/or apis of each class. – Stultuske Aug 25 '15 at 09:13
  • Something Oracle posts about changes like this: http://www.oracle.com/technetwork/java/javase/8-compatibility-guide-2156366.html#A999154 Two titles below might also be worth a look. – Stultuske Aug 25 '15 at 09:25

3 Answers3

6

Check the JDK 8 Adoption guide for the incompatibilities between JDK 8 and JDK 7

Gopidoss
  • 254
  • 1
  • 6
  • Does this include all the fixed bugs? Because you know, there is no bug stupid enough that no one would rely on it's existence ... – Jens Schauder Aug 25 '15 at 09:14
  • That list doesn't include bug fixes that change behaviour between Java 7 and 8. – assylias Aug 25 '15 at 13:11
  • 1
    Very useful but not thorough! as an example no mentioned split method. the one that caused problem to me! I need a solid list of all changes before adapting java 8 :( – Morteza Adi Aug 25 '15 at 19:37
1

I don't think there is an easy way to find an exhaustive list. You could run a query in the bug database, for example by looking for bugs in the core libraries affecting versions < 8 and fixed in 8.

That query returns about 320 issues and the bug fix you mention in your question is on page 6 (Creation date: 2007-05-18).

assylias
  • 321,522
  • 82
  • 660
  • 783
  • Thanks, I will go through the list; however i need a full incompatibilities, the query only brings bug fixes. – Morteza Adi Aug 25 '15 at 19:49
  • @MortezaAdi The incompatibilities (i.e. the intentional changes to the specs) are detailed on oracle's website (see other answer). – assylias Aug 26 '15 at 10:31
-1

Java's core libraries has always been kept as backwards compatible as possible and changes to things like String will surely receive a lot of scrutiny and testing before release.

The API spec of String.split() has never changed. (In fact, its implementations in JDK 7 and 8 are identical as well.)

Your code relied on implementation peculiarities that where never guaranteed by the API. (Most likely the old substring behaviour that reuses the same backing string.)

billc.cn
  • 7,187
  • 3
  • 39
  • 79