Package st.redline.classloader

Examples of st.redline.classloader.SmalltalkClassLoader


    public PrimSubclass() {
        name = "PrimSubclass-block";
    }

    protected ProtoObject invoke(ProtoObject receiver, PrimContext context) {
        SmalltalkClassLoader smalltalkClassLoader = classLoader();
        String name = subclassNameFrom(context);
        ProtoObject sublcass = createSubclass(smalltalkClassLoader.METACLASS, (ProtoClass) receiver, name);
        registerClass(smalltalkClassLoader, receiver, name, sublcass);
        return sublcass;
    }
View Full Code Here


        return classBytes();
    }

    private AnalyserDelegate normalDelegate(AnalyserFactory analyserFactory, BytecodeWriterFactory bytecodeWriterFactory,
                                            Source source) {
        SmalltalkClassLoader smalltalkClassLoader = classLoader();
        return new ProgramAnalyser(this, smalltalkClassLoader, analyserFactory, bytecodeWriterFactory, source);
    }
View Full Code Here

    public Thread currentThread() {
        return Thread.currentThread();
    }

    public ProtoObject resolveObject(String name) {
        SmalltalkClassLoader smalltalkClassLoader = classLoader();
        try {
            ProtoObject object = smalltalkClassLoader.loadSmalltalkClass(name, false);
            if (object != null)
                return object;
            if (Character.isUpperCase(name.charAt(0))) {
                String fullyQualifiedName = importFor(name);
                if (fullyQualifiedName != null) {
                    if (fullyQualifiedName.startsWith("#")) {
                        // fullyQualifiedName here is actually Java class name.
//                        return adaptorClassForJavaClassNamed(fullyQualifiedName.substring(1));
                        throw new IllegalStateException("TODO - JCL");
                    } else
                        return resolveObject(fullyQualifiedName);
                }
            }
            // It is expected the loading of an object results in the registering of
            // a Smalltalk class in the class registry.
            object = smalltalkClassLoader.loadSmalltalkClass(name, true);
            if (object != null)
                return smalltalkClassLoader.loadSmalltalkClass(name, false);
            throw new IllegalStateException("Error: Class '" + name + "' should have been resolved by here.");
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

        return instanceOfWith("Array", array);
    }

    public ProtoObject smalltalkSymbol(Object javaValue) {
        String symbol = (String) javaValue;
        SmalltalkClassLoader smalltalkClassLoader = classLoader();
        if (smalltalkClassLoader.isInternedSymbol(symbol))
            return smalltalkClassLoader.internedSymbolAt(symbol);
        ProtoObject symbolObject = instanceOfWith("Symbol", symbol);
        smalltalkClassLoader.internSymbolAtPut(symbol, symbolObject);
        return symbolObject;
    }
View Full Code Here

    @Test
    public void shouldGetClassLoader() {
        ProtoObject object =  new ProtoObject();
        ProtoObject spy = spy(object);
        SmalltalkClassLoader mock = mock(SmalltalkClassLoader.class);
        doReturn(mock).when(spy).classLoader();
        assertEquals(mock, spy.classLoader());
    }
View Full Code Here

    @Mock
    private Bootstrapper bootstrapper;

    @Before
    public void setup() {
        classLoader = new SmalltalkClassLoader(classBuilder, bootstrapper, false);
        when(classBuilder.build(className)).thenReturn(new byte[0]);
    }
View Full Code Here

        classLoader.loadClass(className);
    }

    @Test
    public void shouldBootstrapClassLoader() throws Exception {
        SmalltalkClassLoader classLoader = new SmalltalkClassLoader(classBuilder, bootstrapper, false);
        classLoader.bootstrap();
        verify(bootstrapper).bootstrap((SmalltalkClassLoader) any());
    }
View Full Code Here

        verify(bootstrapper).bootstrap((SmalltalkClassLoader) any());
    }

    @Test
    public void shouldUseNonTracingClassLoaderWhenRequested() {
        SmalltalkClassLoader classLoader = new SmalltalkClassLoader(classBuilder, bootstrapper, false);
        assertEquals("st.redline.classloader.SmalltalkClassLoader$SimpleClassLoader", classLoader.delegate().getClass().getName());
    }
View Full Code Here

        assertEquals("st.redline.classloader.SmalltalkClassLoader$SimpleClassLoader", classLoader.delegate().getClass().getName());
    }

    @Test
    public void shouldUseTracingClassLoaderWhenRequested() {
        SmalltalkClassLoader classLoader = new SmalltalkClassLoader(classBuilder, bootstrapper, true);
        assertEquals("st.redline.classloader.SmalltalkClassLoader$TracingClassLoader", classLoader.delegate().getClass().getName());
    }
View Full Code Here

TOP

Related Classes of st.redline.classloader.SmalltalkClassLoader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.