覆盖泛型(Overriding with generics)
考虑以下抽象类
public abstract class AbstractAssembler { public abstract <T extends AbstractValue> void transform(T value); }
和以下扩展名:
public class MyAssembler extends AbstractAssembler { @Override public void transform(MyValue value) { // ... } }
用
MyValue
public class MyValue extends AbstractValue { // ... }
Eclipse告诉我:MyAssembler类型的方法transform(MyValue)必须覆盖或实现超类型方法
为什么这不起作用?
Consider the following abstract class
public abstract class AbstractAssembler { public abstract <T extends AbstractValue> void transform(T value); }
and the following extension:
public class MyAssembler extends AbstractAssembler { @Override public void transform(MyValue value) { // ... } }
With
MyValue
public class MyValue extends AbstractValue { // ... }
Eclipse tells me: The method transform(MyValue) of type MyAssembler must override or implement a supertype method
Why does this not work?
原文:https://stackoverflow.com/questions/35151208
更新时间:2022-11-08 13:11
最满意答案
在点击汉堡按钮之前,您可以尝试添加几秒钟的等待时间。
Can you give a try by adding a few seconds of wait before clicking the hamburger button.
相关问答
更多-
final ActionBar actionBar = getSupportActionBar(); if(actionBar!=null) { actionBar.setHomeAsUpIndicator(android.R.drawable.ic_drawer); actionBar.setDisplayHomeAsUpEnabled(true); } 在任何活动中使用上面的代码来放置导航抽屉的图标。 您甚至可以在不同的活动中更改它。 使用以下代 ...
-
当单击页面链接一次时,导航/汉堡包图标消失(Navigation/hamburger icon disappear when page link is clicked once)[2023-07-09]
您还需要将切换添加到复选框。 它是一个jQuery函数,它使用特定的动画和样式。 $('#show-menu').click(function() { $('#menu').slideToggle(); }); 编辑 我添加了一个工作示例。 我没有在这里使用切换,以获得更好的设计。 现在,菜单也会点击复选框:-) $(document).ready(function() { $('a').click(function() { $('#menu').slideToggle ... -
使用Appium自动化应用程序时自动解除iOS警报(Automatically dismiss iOS Alerts when automating an app with Appium)[2024-02-08]
根据Appium团队的文档,看起来好像自动接受所有对话框的功能被破坏了。 因此,我对行为进行了硬编码,而不是依靠appium。 也许这将在下一个版本中得到解决。 According to documentation from the Appium team it appears as though the desired capability for automatically accepting all dialogs is broken. As such I have hard-coded the ac ... -
如何在模拟器上使用appium自动化Android手机后退按钮(How to automate the android phone back button using appium on emulator)[2023-05-26]
你需要使用以下代码返回。 driver.pressKeyCode(AndroidKeyCode.BACK); you need to use following code for go back. driver.pressKeyCode(AndroidKeyCode.BACK); -
越少越好。 为什么要使用包名访问id? 顺便说一下,您已在功能中指定了包名称,因此appium在内部使用带有包名称的id来定位应用程序组件。 如果组件属于其他应用程序,则需要提供包含其包名称的id。 您不需要运行selenium服务器,您需要运行Appium Server。 AndroidDriver扩展了Abstract AppiumDriver,它扩展了DefaultGenericMobileDriver(这也是抽象的),这个abtract类扩展了RemoteWebDriver。 因此,AndroidD ...
-
在点击汉堡按钮之前,您可以尝试添加几秒钟的等待时间。 Can you give a try by adding a few seconds of wait before clicking the hamburger button.
-
使用java的appium自动化(appium automation using java)[2022-04-16]
你能尝试点击元素的坐标,看它是否有效? 尝试这样的事情 - Point point = element.getLocation(); int x = point.x; int y = point.y; TouchAction touchAction = new TouchAction(driverMobile); touchAction.tap(x, y).perform(); Can you try to click on the coordinates of the element and see ... -
在上面的代码中,首先在页面上搜索link_text link 。 如果没有找到链接,则返回nil。 因此,为了使此代码有效,我们需要等待链接文本的链接出现在页面上,然后单击它。 因此,您可以在点击fink之前使用下面提到的任何一个代码 page.should have_content(link_text) page.find_link(link_text) 如果上述代码不起作用,那么您也可以尝试增加默认等待时间,如下所示: Capybara.default_wait_time = 30 page.shoul ...
-
添加desired_caps['automationName'] = 'UiAutomator2'并尝试使用以下方法查找元素: self.driver.find_element_by_id('com.android.vending:id/secondary_avatar_frame_right') 我强烈建议使用appium-desktop来检查元素: Add desired_caps['automationName'] = 'UiAutomator2' and try to find element w ...
-
如果你有汉堡包图标,如何实现后退按钮功能?(How to implement back button feature when you have hamburger icon?)[2022-09-15]
通常情况下,你不需要有后退箭头或按钮,因为Android有一个内置在操作系统中的后退按钮,这对用户来说也很容易。 如果您在导航抽屉打开时不知道如何处理它,这是代码。 @Override public void onBackPressed() { if (isNavDrawerOpen()) { closeNavDrawer(); } else { super.onBackPressed(); } } 后退箭头不能与汉堡包图标一起放置在工具栏中。 因此 ...