1 Reply Latest reply: Apr 11, 2011 5:53 AM by jduprez RSS

    Compile error on .class for an array.

    thedatawarehouse
      How do I write the code below correctly?
              final ArgumentCaptor<MessageToken[]> tokenArg = ArgumentCaptor.forClass(MessageToken[].class);
        • 1. Re: Compile error on .class for an array.
          jduprez
          How do I write the code below correctly?
          final ArgumentCaptor<MessageToken[]> tokenArg = ArgumentCaptor.forClass(MessageToken[].class);
          What is the exact compilation error?
          Note that since ArgumentCaptor is probably a custom class that only you or your team knows about, we will maybe not be able to help a lot, we will probably need that you give us the signature of its method forClass

          Note that the problem is not that the syntaxfor the array class MessageToken[].class is illegal in itself; the following compiles perfectly:
          public class TestClassLitteral {
              Class stringClass = String.class;
              Class stringArrayClass = String[].class;
          }