Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Snippet] Check if a class overrides all overridable methods from a super class

Featured Replies

Checks if all overridable methods from a class are indeed overriden.

Useful for writing decorator classes / wrappers.

 

Example:

public class InteractableObjectDecorator extends InteractableObject {

	static {
		ReflectionUtil.checkOverrides(InteractableObjectDecorator.class, InteractableObject.class);
	}
	
	public InteractableObjectDecorator(XInteractableObject instance) {
		super(instance);
	}

}
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public java.lang.String org.osbot.rs07.api.model.InteractableObject.getName() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public java.lang.String[] org.osbot.rs07.api.model.InteractableObject.getActions() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getId() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getType() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.api.def.EntityDefinition org.osbot.rs07.api.model.InteractableObject.getDefinition() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.api.def.ObjectDefinition org.osbot.rs07.api.model.InteractableObject.getDefinition() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.exists() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getLocalY() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getGridY() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getOrientation() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.isOnScreen() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getZ() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int[] org.osbot.rs07.api.model.InteractableObject.getModelIds() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.api.map.Area org.osbot.rs07.api.model.InteractableObject.getArea(int) from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getUID() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getLocalX() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getGridX() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.hasAction(java.lang.String[]) from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.api.map.Position org.osbot.rs07.api.model.InteractableObject.getPosition() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.isPlayer() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.isNPC() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.api.model.Animable org.osbot.rs07.api.model.InteractableObject.getAnimable() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getY() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getSizeY() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.isVisible() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.interact(java.lang.String[]) from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getX() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.hover() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getSizeX() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getConfig() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.isGameObject() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.examine() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public void org.osbot.rs07.api.model.Modeled.setPrioritized(boolean) from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.Modeled.isPrioritized() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public void org.osbot.rs07.api.model.Modeled.updateModel(org.osbot.rs07.api.model.Model) from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.api.model.Model org.osbot.rs07.api.model.Modeled.getModel() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.Modeled.getHeight() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.script.MethodProvider org.osbot.rs07.api.RS07Wrapper.getMethods() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.api.Client org.osbot.rs07.api.RS07Wrapper.getClient() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.core.AbstractBot org.osbot.rs07.api.RS07Wrapper.getBot() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.Bot org.osbot.rs07.api.RS07Wrapper.getBot() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.core.api.Wrapper.equals(java.lang.Object) from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public java.lang.String java.lang.Object.toString() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public native int java.lang.Object.hashCode() from class org.osbot.rs07.api.model.InteractableObject
	at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71)
	at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11)
 

Snippet

	public static void checkOverrides(Class<?> subClass, Class<?> superClass) {
		for (Method superMethod : superClass.getMethods()) {
			if(Modifier.isStatic(superMethod.getModifiers())) continue;
			if(Modifier.isFinal(superMethod.getModifiers())) continue;
			try {
				Method subMethod = subClass.getMethod(superMethod.getName(), superMethod.getParameterTypes());
				if(subMethod.getDeclaringClass().equals(superMethod.getDeclaringClass())) {
					throw new NoSuchMethodException(subClass + " does not override " + superMethod + " from " + superClass);
				}
			} catch (NoSuchMethodException e) {
				e.printStackTrace();
			} catch (SecurityException e) {
				e.printStackTrace();
			}			
		}
	}

Edited by Botre

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.