Compilation yields no class files, no errors

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu May 24 03:35:22 PDT 2012


Fixed in the lambda repository.
Thanks for the report

Maurizio

On 23/05/12 23:28, David Conrad wrote:
> I ran into something weird with the May 11 lambda build this afternoon.
> The compiler exited normally, but generated no class files. No errors.
>
> The simplest case I've been able to get it down to: Here's TextFile.java:
>
> interface Read<T>  {
>      T read(T value, String line);
> }
>
> interface Lines {
>      void read(String line, int number);
> }
>
> interface Liner<T>  {
>      T read(T value, String line, int number);
> }
>
> public class TextFile<T>  {
>      private final java.util.List<String>  list;
>      private final T initial;
>
>      public TextFile(final java.util.List<String>  list, final T initial) {
>          this.list = list;
>          this.initial = initial;
>      }
>
>      public T read(Read<T>  reader) {
>          return read((t, s, i) ->  { return reader.read(t, s); });
>      }
>
>      public void read(Lines reader) {
>          read((t, s, i) ->  { reader.read(s, i); return t; });
>      }
>
>      public T read(Liner<T>  reader) {
>          int number = 0;
>          T value = initial;
>          for (String line : list) {
>              value = reader.read(value, line, ++number);
>          }
>          return value;
>      }
> }
>
> TextFile.java compiles okay. Problem.java doesn't, unless I uncomment /*,
> number*/:
>
> public class Problem {
>      public static void main(String[] args) {
>          java.util.List<String>  list = java.util.Arrays.asList(args);
>
>          TextFile<StringBuilder>  textfile =
>              new TextFile<>(list, new StringBuilder());
>
>          StringBuilder sb =
>              textfile.read((builder, string/*, number*/) ->  {
>                  if ("good".equals(string)) {
>                      //System.out.println("line " + number + " matches");
>                      builder.append(string);
>                  }
>                  return builder;
>              });
>
>          System.out.println(sb);
>      }
> }
>
> Also, Problem.java compiles, even without the third parameter to the lambda,
> if I eliminate interface Lines from TextFile.java. So, I thought it was
> getting
> confused between the two functional interfaces that both take two
> parameters.
> But adding explicit types to the lambda parameters in Problem.java doesn't
> help. The compiler runs, exits with status 0, but no class files.
>
> I tried compiling with javac -Xlint:all -verbose Problem.java, but it looks
> just
> like it should, except there are no [wrote RegularFileObject[*.class]]
> lines.
> Unfortunately, that's all the compiler-fu I possess.
>
> Is this a bug, or is my environment hosed somehow? I didn't build it, I'm
> using the 64-bit windows build of May 11 from jdk8.java.net/lambda.
>
> Perplexed,
> David
>
> (It all started with a funny class that was going to take a lambda and call
> it for every line of a text file, modulo a few overloads, if you're
> wondering.)
>



More information about the lambda-dev mailing list