Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception happened when test the example: array.av #272

Closed
kevenYLi opened this issue Aug 4, 2020 · 2 comments
Closed

Exception happened when test the example: array.av #272

kevenYLi opened this issue Aug 4, 2020 · 2 comments

Comments

@kevenYLi
Copy link

kevenYLi commented Aug 4, 2020

background:

  • Branch: 5.1.2
  • OS: mac mojave 10.14.6

reproduce steps

  • download aviator shell according to guideline
  • change privileges
  • execute the command: bash avaitor
  • clone the codes of aviator
  • cd aviator
  • execute the command: bash ~/bin/aviator examples/array.av

stacktrace

type(a) is : int[]
count(a) is: 4
hello,world,aviator
Exception in thread "main" java.lang.ClassNotFoundException: java.lang.int
      at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:264)
      at com.googlecode.aviator.runtime.function.seq.SeqNewArrayFunction.call(SeqNewArrayFunction.java:56)
      at Script_1596537804747_0/1639622804.execute0(Unknown Source)
      at com.googlecode.aviator.ClassExpression.executeDirectly(ClassExpression.java:65)
      at com.googlecode.aviator.BaseExpression.execute(BaseExpression.java:132)
      at com.googlecode.aviator.Main.main(Main.java:42)

array.av

## examples/array.av

let a = seq.array(int, 1, 2, 3, 4);

println("type(a) is : " + type(a));
println("count(a) is: " + count(a));

let s = seq.array(java.lang.String, "hello", "world", "aviator");

println(string.join(s, ","));

let a = seq.array_of(int, 3);
println("type(a) is : " + type(a));
println("count(a) is: " + count(a));

println("before assignment:");
for x in a {
  println(x);
}

for i in range(0, 3) {
  a[i] = i;
}

println("after assignment:");
for x in a {
  println(x);
}


@killme2008
Copy link
Owner

Thank you ,it's a bug in seq.array_of function ,you can use seq.array_of(Integer, 3) to avoid it. I will fix it ASAP.

killme2008 added a commit that referenced this issue Aug 20, 2020
(fix) #272, seq.array_of can't create primive types array
@killme2008
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants