Hi there,

having enclosed all the “foo as bar”'s in ternary operators in parentheses, I 
have bumped into a completely weird problem which I can't wrap my head on -- 
for many classes I am with Groovy 3 getting completely weird errors of kind

“constructor X in class Y cannot be applied to given types”

What gives and how to solve the problem? Note again that the code _did_ build 
and _did work properly_ (tested zillion times) with Groovy 2, so there can't be 
anything seriously wrong with the sources. Looks like another breaking change :(

I succeeded to isolate it into a pretty small source with just one pretty 
standard JAR like this:

===
194 ocs /tmp> <CreateSignatureBase.java 
/*
 * Copyright 2015 The Apache Software Foundation.

 * OC: removed almost all code, leaving just what's needed to crash

 */

package org.apache.pdfbox.examples.signature;

import java.io.IOException;
import java.io.InputStream;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import 
org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface;

public abstract class CreateSignatureBase implements SignatureInterface
{
    public CreateSignatureBase(KeyStore keystore, char[] pin)
            throws KeyStoreException, UnrecoverableKeyException, 
NoSuchAlgorithmException, IOException, CertificateException
    { }
    @Override
    public byte[] sign(InputStream content) throws IOException
    {
        return null;
    }
}

195 ocs /tmp> <myclass.groovy 
package cz.ocs.utilities

import groovy.transform.*
import org.apache.pdfbox.pdmodel.*
import org.apache.pdfbox.examples.signature.CreateSignatureBase

@InheritConstructors class CreateSignature extends CreateSignatureBase {
    void signPDF(PDDocument pdd, OutputStream out) {

    }
}

196 ocs /tmp> /usr/local/groovy-2.4.17/bin/groovyc -cp 
/Extensions/pdfbox-2.0.17.jar -j myclass.groovy CreateSignatureBase.java
197 ocs /tmp> /usr/local/groovy-3.0.3/bin/groovyc -cp 
/Extensions/pdfbox-2.0.17.jar -j myclass.groovy CreateSignatureBase.java
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Compile error during compilation with javac.
/var/folders/zh/h4cv6xjx033frtt9y72ch8980000gp/T/groovy-generated-8946934250394256568-java-source/cz/ocs/utilities/CreateSignature.java:12:
 error: constructor CreateSignatureBase in class CreateSignatureBase cannot be 
applied to given types;
@groovy.transform.InheritConstructors() public class CreateSignature
                                               ^
  required: KeyStore,char[]
  found: no arguments
  reason: actual and formal argument lists differ in length
1 error


1 error

198 ocs /tmp> 

===

Thanks and all the best,
OC


Reply via email to