From a88b99b80b30252293638f62bdcf295ad3136235 Mon Sep 17 00:00:00 2001 From: sefftinge Date: Fri, 29 Feb 2008 14:24:40 +0000 Subject: static typesystem (first draft) --- .../typesystem/ConcreteTypeArgument.java | 24 ++++++++++++++++ .../xand3/analyzation/typesystem/DeclaredType.java | 22 +++++++++++++++ .../typesystem/DeclaredTypeParameter.java | 20 ++++++++++++++ .../xand3/analyzation/typesystem/Feature.java | 24 ++++++++++++++++ .../xand3/analyzation/typesystem/NamedElement.java | 24 ++++++++++++++++ .../xand3/analyzation/typesystem/Operation.java | 24 ++++++++++++++++ .../xand3/analyzation/typesystem/Property.java | 24 ++++++++++++++++ .../eclipse/xand3/analyzation/typesystem/Type.java | 29 ++++++++++++++++++++ .../xand3/analyzation/typesystem/TypeArgument.java | 19 +++++++++++++ .../typesystem/WildcardTypeArgument.java | 32 ++++++++++++++++++++++ 10 files changed, 242 insertions(+) create mode 100644 plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/ConcreteTypeArgument.java create mode 100644 plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/DeclaredType.java create mode 100644 plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/DeclaredTypeParameter.java create mode 100644 plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/Feature.java create mode 100644 plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/NamedElement.java create mode 100644 plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/Operation.java create mode 100644 plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/Property.java create mode 100644 plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/Type.java create mode 100644 plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/TypeArgument.java create mode 100644 plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/WildcardTypeArgument.java diff --git a/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/ConcreteTypeArgument.java b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/ConcreteTypeArgument.java new file mode 100644 index 00000000..07f45aa5 --- /dev/null +++ b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/ConcreteTypeArgument.java @@ -0,0 +1,24 @@ +/** + * + * + * Copyright (c) 2002-2007 itemis AG and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * itemis AG - Initial API and implementation + * + * + * + */ +package org.eclipse.xand3.analyzation.typesystem; + +/** + * @author Sven Efftinge + * + */ +public interface ConcreteTypeArgument extends TypeArgument{ + Type[] getType(); +} diff --git a/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/DeclaredType.java b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/DeclaredType.java new file mode 100644 index 00000000..41d7ae1d --- /dev/null +++ b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/DeclaredType.java @@ -0,0 +1,22 @@ +/** + * + * + * Copyright (c) 2002-2007 itemis AG and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * itemis AG - Initial API and implementation + * + * + * + */ +package org.eclipse.xand3.analyzation.typesystem; + +public interface DeclaredType extends NamedElement { + DeclaredType[] getSuperTypes(); + DeclaredTypeParameter[] getTypeParameters(); + Type createInstance(TypeArgument... args); +} diff --git a/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/DeclaredTypeParameter.java b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/DeclaredTypeParameter.java new file mode 100644 index 00000000..eefa9508 --- /dev/null +++ b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/DeclaredTypeParameter.java @@ -0,0 +1,20 @@ +/** + * + * + * Copyright (c) 2002-2007 itemis AG and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * itemis AG - Initial API and implementation + * + * + * + */ +package org.eclipse.xand3.analyzation.typesystem; + +public interface DeclaredTypeParameter extends NamedElement { + DeclaredType[] getUpperBounds(); +} diff --git a/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/Feature.java b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/Feature.java new file mode 100644 index 00000000..25e5a0b2 --- /dev/null +++ b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/Feature.java @@ -0,0 +1,24 @@ +/** + * + * + * Copyright (c) 2002-2007 itemis AG and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * itemis AG - Initial API and implementation + * + * + * + */ +package org.eclipse.xand3.analyzation.typesystem; + +/** + * @author Sven Efftinge + * + */ +public interface Feature { + +} diff --git a/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/NamedElement.java b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/NamedElement.java new file mode 100644 index 00000000..0c780077 --- /dev/null +++ b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/NamedElement.java @@ -0,0 +1,24 @@ +/** + * + * + * Copyright (c) 2002-2007 itemis AG and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * itemis AG - Initial API and implementation + * + * + * + */ +package org.eclipse.xand3.analyzation.typesystem; + +/** + * @author Sven Efftinge + * + */ +public interface NamedElement { + String getName(); +} diff --git a/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/Operation.java b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/Operation.java new file mode 100644 index 00000000..0db349cd --- /dev/null +++ b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/Operation.java @@ -0,0 +1,24 @@ +/** + * + * + * Copyright (c) 2002-2007 itemis AG and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * itemis AG - Initial API and implementation + * + * + * + */ +package org.eclipse.xand3.analyzation.typesystem; + +/** + * @author Sven Efftinge + * + */ +public interface Operation { + +} diff --git a/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/Property.java b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/Property.java new file mode 100644 index 00000000..712e7168 --- /dev/null +++ b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/Property.java @@ -0,0 +1,24 @@ +/** + * + * + * Copyright (c) 2002-2007 itemis AG and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * itemis AG - Initial API and implementation + * + * + * + */ +package org.eclipse.xand3.analyzation.typesystem; + +/** + * @author Sven Efftinge + * + */ +public interface Property { + +} diff --git a/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/Type.java b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/Type.java new file mode 100644 index 00000000..b4265f30 --- /dev/null +++ b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/Type.java @@ -0,0 +1,29 @@ +/** + * + * + * Copyright (c) 2002-2007 itemis AG and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * itemis AG - Initial API and implementation + * + * + * + */ +package org.eclipse.xand3.analyzation.typesystem; + +public interface Type extends NamedElement { + Type[] getSuperTypes(); + + Feature[] getFeatures(); + Property[] getProperties(); + Operation[] getOperations(); + + /** + * @return returns either the {@link DeclaredType} this type is a bound instance of or this, if the originally declared type wasn't unbound + */ + DeclaredType getDeclaredType(); +} diff --git a/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/TypeArgument.java b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/TypeArgument.java new file mode 100644 index 00000000..6482eb60 --- /dev/null +++ b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/TypeArgument.java @@ -0,0 +1,19 @@ +/** + * + * + * Copyright (c) 2002-2007 itemis AG and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * itemis AG - Initial API and implementation + * + * + * + */ +package org.eclipse.xand3.analyzation.typesystem; + +public interface TypeArgument { +} diff --git a/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/WildcardTypeArgument.java b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/WildcardTypeArgument.java new file mode 100644 index 00000000..5afbe821 --- /dev/null +++ b/plugins/org.eclipse.xpand3/src/org/eclipse/xand3/analyzation/typesystem/WildcardTypeArgument.java @@ -0,0 +1,32 @@ +/** + * + * + * Copyright (c) 2002-2007 itemis AG and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * itemis AG - Initial API and implementation + * + * + * + */ +package org.eclipse.xand3.analyzation.typesystem; + +/** + * @author Sven Efftinge + * + */ +public interface WildcardTypeArgument extends TypeArgument { + /** + * @return the lower bound type (specified using e.g. <* super MyType>) + */ + Type getLowerBound(); + + /** + * @return the upper bounds (specified using e.g. <* extends Comparable,Serializable>) + */ + Type[] getUpperBounds(); +} -- cgit v1.2.3