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

Custom classes #26

Open
TPGamesNL opened this issue Jul 17, 2020 · 11 comments
Open

Custom classes #26

TPGamesNL opened this issue Jul 17, 2020 · 11 comments
Labels
enhancement New feature or request priority: low

Comments

@TPGamesNL
Copy link
Member

TPGamesNL commented Jul 17, 2020

Be able to extend classes as well as implement them (maybe both at the same time).
Resources:
http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/sun/misc/ProxyGenerator.java
https://marschall.github.io/2017/07/11/java-proxy-anatomy.html (see this one to save generated files)
Also experiment if ClassLoader#defineClass can be used properly (link)
Idea for syntax:

class extends AbstractMap:
# class [extends %javatype%] [implements %javatypes%]
	
	# access modifier: [(public|private|protected)]
	# %access modifier% %javatype% %identifier%
	public Integer testField
	
	# %access modifier% (%javatype%|void) %identifier%([parameters])
	# %identifier%: %javatype%
	public void doMethod(a: Integer, b: String):
		broadcast "HEY"

# note: %identifier% and %access modifier% aren't actual types, just to make it easy to read the syntax here

# look into:
	# class name
	# primitive types
	# syntax for varargs

EDIT: probably name this custom classes

@TPGamesNL TPGamesNL changed the title All-class proxies Custom classes Aug 6, 2020
@TPGamesNL TPGamesNL added enhancement New feature or request priority: low labels Dec 25, 2020
@ccorp2002
Copy link

I think this would be pretty cool to use, ngl it could help a lot with some things, the real issue i'd suspect is the implementation in skript itself.

@TPGamesNL
Copy link
Member Author

The syntax has been changed since I made this issue, here's an example of the current syntax:

public class MyClass:
	
	private int myNumber
	
	public MyClass(int i):
		set this.myNumber to {_i}
	
	public int getMyNumber():
		return this.myNumber

@ccorp2002
Copy link

So wait, its been added? Or were you just changing the initial syntax comment

@TPGamesNL
Copy link
Member Author

It hasn't been added, but I've been working on it locally, although there are still things left to be done

@ccorp2002
Copy link

Ah still, that'd be pretty cool once its done. If you need any testers just ask me.

@MrScopes
Copy link

wondering on the progress of this

@TPGamesNL
Copy link
Member Author

Not much, it won't be available until the Structure API is merged

@LowScarlet
Copy link

any progress?

@TPGamesNL
Copy link
Member Author

If there's any progress I'll post it here no need to ask

@LowScarlet

This comment was marked as spam.

@LowScarlet

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: low
Projects
None yet
Development

No branches or pull requests

4 participants