Menu

#61 Constructor in ant task

closed-fixed
None
7
2004-11-21
2004-09-14
No

Version : 3.0.7
JDK : 1.3
OS : M$ Windows XP

When I try to use the ant task with an XML
configuration with constructor, like:

<keepclasseswithmembers name="com.zz.**.*X">
<constructor access="public" parameters="com..zz.MyClass"/>
</keepclasseswithmembers>

The build process fails and an error:

BUILD FAILED: file:build.xml:46: Type and parameters
attributes must always be present in combination in
method specification

If the above line is removed, the problem does not
occur anymore. I read the documentation, but I can
figure out why this error happens.

Thanks for your work and help.

Related

Bugs: #489

Discussion

  • Eric Lafortune

    Eric Lafortune - 2004-09-14
    • status: open --> open-invalid
     
  • Eric Lafortune

    Eric Lafortune - 2004-09-14

    Logged In: YES
    user_id=555208

    The error message means that you must specify the "type"
    attribute if you specify the "parameters" attribute. Just
    like in the ProGuard configuration outside of Ant, one can't
    go without the other. So you may want to add something like
    type="void", or type="**".

     
  • Eric Lafortune

    Eric Lafortune - 2004-09-14
    • priority: 5 --> 1
    • assigned_to: nobody --> lafortune
     
  • William Shubert

    William Shubert - 2004-10-08

    Logged In: YES
    user_id=534415

    Adding a "type" doesn't work so well either. Adding this:

    <constructor
    type="**"
    param="java.rmi.activation.ActivationID,java.rmi.MarshalledObject"/>

    spits out:

    /home/wms/apps/igoweb/build.xml:741: Type attribute not
    allowed in constructor specification [**]

    Setting type to "void" gives a similar output. So it seems
    the only workaround right now is to use the non-XML
    configuration.

     
  • Eric Lafortune

    Eric Lafortune - 2004-10-11
    • priority: 1 --> 7
    • status: open-invalid --> open-accepted
     
  • Eric Lafortune

    Eric Lafortune - 2004-10-11

    Logged In: YES
    user_id=555208

    You're right; I hadn't noticed you were referring to a
    constructor, not just a method. This is a genuine bug. It
    should be fixed by changing the body of the if-statement at
    line 72 in proguard/ant/ClassMemberSpecificationElement.java to:

    if (isConstructor)
    {
    if (type != null)
    {
    throw new BuildException("Type attribute
    not allowed in constructor specification ["+type+"]");
    }

    if (parameters != null)
    {
    type = ClassConstants.EXTERNAL_TYPE_VOID;
    }

    name = ClassConstants.INTERNAL_METHOD_NAME_INIT;
    }

    Please let us know if you get the chance to try it out. This
    fix will be applied in the next version.

     
  • Eric Lafortune

    Eric Lafortune - 2004-11-21
    • status: open-accepted --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB