peichhorn / lombok-pg

Collection of lombok extensions
http://peichhorn.github.com/lombok-pg/
Other
326 stars 44 forks source link

Upgrading to 0.11.2 issue #111

Closed nicholas22 closed 11 years ago

nicholas22 commented 11 years ago

Internal compiler error: java.lang.ArrayIndexOutOfBoundsException: -2 at org.eclipse.jdt.internal.compiler.codegen.StackMapFrame.addStackItem(StackMapFrame.java:92) Linq.java /jpropel/src/propel/core/utils line 0 Java Problem

This method is the culprit (used to compile under 0.10.0)

    @Validate
    @SuppressWarnings("unchecked")
    public static <T> Iterable<T> concat(@NotNull final Iterable<? extends T>... values)
    {
      ReifiedArray<? extends T> array = new ReifiedArray<T>(values);

      for (Iterable<? extends T> vals : array)
      {
        if (vals == null)
          throw new NullPointerException("Item of values");

        for (final T item : vals)
          yield(item);
      }
    }
peichhorn commented 11 years ago

I'm going to check it out. I'm sure you mean version 0.11.2. I think it's better if you would wait for 0.11.4 to come out, since 0.11.2 has an epic memleak that was plugged just 3 days ago. (memleak in lombok ^^) If you want to try out some new stuff, I could easily release 0.11.3 just to get rid off the memleak.

peichhorn commented 11 years ago

Looking at this, I think this is definitely a position info bug. Not exactly sure what changed in lombok since I didn't touch anything in lombok-pg. But I will know more once I get home from work.

EDIT: No that wasn't it... must.... not... guess....

peichhorn commented 11 years ago

When I try the provided snipped (with the current HEAD I might add) , I get:

Type mismatch: cannot convert from Iterator<capture#9-of ? extends T> to Iterator<T>

Type mismatch: cannot convert from element type capture#1-of ? extends T to Iterable<? extends T>

Type mismatch: cannot convert from Iterator<capture#5-of ? extends T> to Iterator<Iterable<? extends T>>

These errors make sense, I'm not sure why you didn't see them earlier but I'm going to try out the provided example with 0.11.0 and 0.10.0 as well.

Here is the method, with the correct use of generic:

@Validate
@SuppressWarnings("unchecked")
public static <T> Iterable<T> concat(@NotNull final Iterable<? extends T>... values) {
  val array = new ReifiedArray<Iterable<T>>(values);

  for (val vals : array) {
    if (vals == null) throw new NullPointerException("Item of values");

    for (val item : vals) yield(item);
  }
}

EDIT: I've updated the error messages.. also used ReifiedArray of jpropel EDIT: Updated example, you can even use val now..

peichhorn commented 11 years ago

The provided code did indeed work with lombok-pg 0.10.0 and 0.11.0 in both eclipse and javac. In earlier version of yield there was a hard cast in yield, that was totally unnecessary, apparently this cast was hiding some major bugs. Sorry about that. I should really release 0.11.3..

nicholas22 commented 11 years ago

Not your fault is it? :) (I thought yield is contributed)

peichhorn commented 11 years ago

Not your fault is it? :) (I thought yield is contributed)

I'm pretty sure, that I've messed it up..

nicholas22 commented 11 years ago

Nothing to be sorry about! We're sticking with 0.11.0 for now. I think the thing that's going to force an upgrade is mixin support xD

peichhorn commented 11 years ago

na 0.11.3 is on the way (few hours to central sync though).. there are some major bugfixes since 0.11.0.. if you got some time please try out 0.11.3..

I really need to add a changelog xD