shreyashsaitwal / rush-cli

:zap: A new and improved way of building MIT AI2 extensions.
GNU General Public License v3.0
46 stars 24 forks source link

Cannot find some of the simple app inventor symbols while building? #60

Closed aeozyalcin closed 3 weeks ago

aeozyalcin commented 1 month ago

Describe the bug When building my extension, rush/java complains about not being able to find some of the symbols that should exist! For example,

To Reproduce Steps to reproduce the behavior:

Here is the simple test project I am using, which is based off of the sample java file that gets added to each new project. All I have changed is the imports, by adding a few more imports. Looking here, all these symbols should exist, but java is complaining about not finding the SimpleObject symbol. It is clearly able to find SimpleFunction and SimpleProperty just fine.

package test;

import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.errors.YailRuntimeError;
import com.google.appinventor.components.runtime.util.YailList;

public class Test extends AndroidNonvisibleComponent {

  public Test(ComponentContainer container) {
    super(container.$form());
  }

  @SimpleFunction(description = "Returns the sum of the given list of integers.")
  public int SumAll(YailList integers) {
    int sum = 0;

    for (final Object o : integers.toArray()) {
      try {
        sum += Integer.parseInt(o.toString());
      } catch (NumberFormatException e) {
        throw new YailRuntimeError(e.toString(), "NumberFormatException");
      }
    }

    return sum;
  }
}
  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior I would expect this project to compile just fine without errors, since Rush says that all I need is JDK8, and no need for a local copy of the App Inventor repo.

Screenshots

image

Desktop (please complete the following information): Ubuntu 22 on Intel 64-bit

Additional context Add any other context about the problem here.

shreyashsaitwal commented 1 month ago

Rush doesn't require SimpleObject annotation for building your extension, and therefore, it has been removed from Rush's version of annotations package. You can find available annotations here.

Do you have any specific use case that requires this annotation?

aeozyalcin commented 3 weeks ago

I wanted to modify an existing extension, where I only have access to the .java file. So I was hoping to make minor changes and recompile. I ended up using Niotron for it. Thank you for the heads up.