Skip to content

java-source-utils unable to extract parameters in AndroidX.Core source jar #920

@jpobst

Description

@jpobst

In androidx.core.core-1.7.0, the jar is no longer compiled with --parameters which causes breaking changes to our resulting binding. In an attempt to fix this, we added the appropriate <JavaSourceJar>.

This fixed many of the issues, however there are many issues reported by the java-source-utils process, which prevent it from fully populating the parameter names.

For example:

package androidx.core.view;

import android.view.View;

import androidx.annotation.NonNull;

/**
 * This interface should be implemented by {@link android.view.ViewGroup ViewGroup} subclasses
 * that wish to support scrolling operations delegated by a nested child view.
 *
 * <p>Classes implementing this interface should create a final instance of a
 * {@link NestedScrollingParentHelper} as a field and delegate any View or ViewGroup methods
 * to the <code>NestedScrollingParentHelper</code> methods of the same signature.</p>
 *
 * <p>Views invoking nested scrolling functionality should always do so from the relevant
 * {@link ViewCompat}, {@link ViewGroupCompat} or {@link ViewParentCompat} compatibility
 * shim static methods. This ensures interoperability with nested scrolling views on all versions
 * of Android.</p>
 */
public interface NestedScrollingParent3 extends NestedScrollingParent2 {

    /**
     * React to a nested scroll in progress.
     *
     * <p>This method will be called when the ViewParent's current nested scrolling child view
     * dispatches a nested scroll event. To receive calls to this method the ViewParent must have
     * previously returned <code>true</code> for a call to
     * {@link #onStartNestedScroll(View, View, int, int)}.
     *
     * <p>Both the consumed and unconsumed portions of the scroll distance are reported to the
     * ViewParent. An implementation may choose to use the consumed portion to match or chase scroll
     * position of multiple child elements, for example. The unconsumed portion may be used to
     * allow continuous dragging of multiple scrolling or draggable elements, such as scrolling
     * a list within a vertical drawer where the drawer begins dragging once the edge of inner
     * scrolling content is reached.
     *
     * <p>This method is called when a nested scrolling child invokes
     * {@link NestedScrollingChild3#dispatchNestedScroll(int, int, int, int, int[], int, int[])}} or
     * one of methods it overloads.
     *
     * <p>An implementation must report how many pixels of the the x and y scroll distances were
     * consumed by this nested scrolling parent by adding the consumed distances to the
     * <code>consumed</code> parameter. If this View also implements {@link NestedScrollingChild3},
     * <code>consumed</code> should also be passed up to it's nested scrolling parent so that the
     * parent may also add any scroll distance it consumes. Index 0 corresponds to dx and index 1
     * corresponds to dy.
     *
     * @param target The descendant view controlling the nested scroll
     * @param dxConsumed Horizontal scroll distance in pixels already consumed by target
     * @param dyConsumed Vertical scroll distance in pixels already consumed by target
     * @param dxUnconsumed Horizontal scroll distance in pixels not consumed by target
     * @param dyUnconsumed Vertical scroll distance in pixels not consumed by target
     * @param type the type of input which cause this scroll event
     * @param consumed Output. Upon this method returning, will contain the scroll
     *                 distances consumed by this nested scrolling parent and the scroll distances
     *                 consumed by any other parent up the view hierarchy
     *
     * @see NestedScrollingChild3#dispatchNestedScroll(int, int, int, int, int[], int, int[])
     */
    void onNestedScroll(@NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed,
            int dyUnconsumed, @ViewCompat.NestedScrollType int type, @NonNull int[] consumed);

}

Results in this error:

## Unable to translate remarks for androidx/core/view/NestedScrollingParent3.onNestedScroll.(L.*View;IIIII[I)V:

React to a nested scroll in progress.
<p>This method will be called when the ViewParent's current nested scrolling child view
dispatches a nested scroll event. To receive calls to this method the ViewParent must have
previously returned <code>true</code> for a call to

... snip ...

@see NestedScrollingChild3#dispatchNestedScroll(int, int, int, int, int[], int, int[])

JavadocImport-Error (31:90): Syntax error, expected: #PCDATA, <tt>, <TT>, <i>, <I>, {@code, {@docRoot}, {@inheritDoc}, {@link, {@linkplain, {@literal, {@value}, {@value, UnknownHtmlElementStart, </tt>, </TT>, </i>, </I>, </p>, </P>, <p>, <P>, <pre>, <PRE>, @author, @apiSince, @deprecated, @deprecatedSince, @exception, @param, @return, @see, @serialData, @serialField, @since, @throws, @[unknown], @version
{@link NestedScrollingChild3#dispatchNestedScroll(int, int, int, int, int[], int, int[])}} or
                                                                                         ^

This results in missing parameter names:

public partial interface INestedScrollingParent3 : global::AndroidX.Core.View.INestedScrollingParent2 {
	// Metadata.xml XPath method reference: path="/api/package[@name='androidx.core.view']/interface[@name='NestedScrollingParent3']/method[@name='onNestedScroll' and count(parameter)=7 and parameter[1][@type='android.view.View'] and parameter[2][@type='int'] and parameter[3][@type='int'] and parameter[4][@type='int'] and parameter[5][@type='int'] and parameter[6][@type='int'] and parameter[7][@type='int[]']]"
	[Register ("onNestedScroll", "(Landroid/view/View;IIIII[I)V", "GetOnNestedScroll_Landroid_view_View_IIIIIarrayIHandler:AndroidX.Core.View.INestedScrollingParent3Invoker, Xamarin.AndroidX.Core")]
	void OnNestedScroll (global::Android.Views.View p0, int p1, int p2, int p3, int p4, int p5, int[] p6);
}

Source jar available here:
https://maven.google.com/web/index.html#androidx.core:core:1.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugComponent does not function as intendedgeneratorIssues binding a Java library (generator, class-parse, etc.)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions