Questions tagged [name-clash]

62 questions
97
votes
9 answers

Java Name Hiding: The Hard Way

I have a problem with name hiding that is extremely hard to solve. Here is a simplified version that explains the problem: There is a class: org.A package org; public class A{ public class X{...} ... protected int net; } Then there…
gexicide
  • 38,535
  • 21
  • 92
  • 152
37
votes
2 answers

Django 1.9: Field clashes with the field of non-existing field in parent model

I have some simple models, Profile, Certifier and Designer, the two latter inheriting from Profile (multi table inheritance). In Designer there’s a foreign key to Certifier. class Profile(models.Model): TYPES = ( ('admin',…
26
votes
4 answers

Same class name in different C++ files

If two C++ files have different definitions of classes with the same name, then when they are compiled and linked, something is thrown out even without a warning. For example, // a.cc class Student { public: std::string foo() { return "A";…
Cyker
  • 9,946
  • 8
  • 65
  • 93
19
votes
3 answers

Java name clash, have the same erasure, neither hides the other

I am getting this name clash error and i don't know how should i solve the problem. I have two classes and i am using overloaded method "createSensors". To simplify here is the code that generates the problem: public abstract class ClassA { …
user506246
  • 301
  • 1
  • 4
  • 15
13
votes
3 answers

Python module and object names clash

Please consider the following Python modules excerpts: foo.py: class Foo: (...) bar.py: import foo foo = foo.Foo() The variable foo, which was a module object, is overwritten with a Foo object. I know that I can use other names for the object,…
João M. S. Silva
  • 1,078
  • 2
  • 11
  • 24
11
votes
2 answers

Java name clash error, despite different method signatures

For fun, I'm trying to implement a "MultiMap" collection, like what already exists in the Apache Commons library. I'm getting an interesting error with my "remove(K key, V value)" method. The compiler says that there is a name clash - that it has…
TheBrownMotie
  • 121
  • 1
  • 6
9
votes
1 answer

Shared library name collisions

I'm distributing a shared library (C++) and a python module that uses this library. I build a modified version of Bullet Physics Library (as a CMake subproject). I only use Bullet classes and functions in one file bullet_interface.cpp and all the…
John
  • 935
  • 6
  • 17
6
votes
2 answers

Generics name clash

Consider: public interface Foo { public static class X{} public void foobar(T t); } public class Bar { Foo foo = new Foo() { public void foobar(X t) {} }; } I found no way to express that I mean the X from…
Landei
  • 54,104
  • 13
  • 100
  • 195
6
votes
1 answer

Name clash when overriding method of generic class

I'm trying to understand the name clash error I get with the following code: import java.util.*; import javax.swing.*; class Foo { public void doSomething(Number n, Map comps) { } } class Bar extends…
Brad Mace
  • 27,194
  • 17
  • 102
  • 148
6
votes
1 answer

New MATLAB version overrides my function with class method. Can I still call my function?

I had a function in a file harmonic.m in my matlab path with prototype: function D = harmonic(A,B,C) where, importantly, A is expected to be a matrix of type double. In version r2014a, apparently MATLAB has created a new builtin class method…
Alec Jacobson
  • 6,032
  • 5
  • 51
  • 88
6
votes
5 answers

C# Default scope resolution

I have inherited a c# class 'Button' (which I can't change) which clashes with the BCL class 'Windows.Forms.Button'. Normally, Id be very happy to go: MyPackage.MyClass.Button; But there are a large number or references to this class which is a…
TK.
  • 46,577
  • 46
  • 119
  • 147
6
votes
2 answers

Avoid name collision with Cake Pattern

I'm currently currently using the Cake Pattern to implement some optimization algorithms. I often hit name collision problems. For instance: trait Add[T] { this: Foo[T] => def constant: T def plus( t1: T, t2: T ): T def add( t: T ) = plus( t,…
paradigmatic
  • 40,153
  • 18
  • 88
  • 147
5
votes
1 answer

C++ Multiple Libraries Define Same Class Name

I am developing a project in which I have a vendor library, say vendor.h, for the specific Arduino-compatible board I'm using which defines class HTTPClient that conflicts with an Arduino system library, HTTPClient.h, which also defines class…
bjg222
  • 827
  • 1
  • 11
  • 21
5
votes
0 answers

Avoiding name clashes when installing packages in Python

When installing packages from PyPI, you have to use the name of the project, which is different from the name of the top-level packages which you will actually import. A clear example is pyserial and serial, which get installed using: pip install…
Aquiles Carattino
  • 910
  • 1
  • 10
  • 23
5
votes
1 answer

ASP.NET MVC 3 Model Binding - ViewBag.Title clash with input of id="Title"

There seems to be an issue with the ViewBag dynamic properties. Lets say I have: @{ ViewBag.Title = @Model.CourseName; } And then in a form on the page I have: @Html.TextBox("Title", null, new {style="width:400px;"}) Where Title is the name…
awrigley
  • 13,481
  • 10
  • 83
  • 129
1
2 3 4 5